#2858
pv
Se consideră un șir a
1
, a
2
, …, a
n
de numere naturale.
10
.3
și aflate pe poziții impare.Problema | pv | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #13574491 | Utilizator | |
Fișier | pv.cpp | Dimensiune | 450 B |
Data încărcării | 28 Ianuarie 2019, 10:00 | Scor / rezultat | Eroare de compilare |
pv.cpp:6:1: error: stray '\342' in program { cin>>n; for(i=1;i<=n;i++) cin>>a[i]; for(i=n;i>=1;i—) cout<<a[i]<<” “; cout<<endl; for(i=1;i<=n;i++) if(a[i]%2==0) s=s+a[i]; cout<<s; cout<<endl; for(i=1;i<=n;i++) if(i%2==0) sp=sp+a[i]; cout<<sp; cout<<endl; for(i=1;i<=n;i++) if(a[i]%10==0) nr=nr+1; cout<<nr; cout<<endl; for(i=1;i<=n;i++) if(a[i]%3==0&&i%2==1) si=si+a[i]; cout<<si; cout<<endl; return 0; ^ pv.cpp:6:1: error: stray '\200' in program pv.cpp:6:1: error: stray '\224' in program pv.cpp:6:1: error: stray '\342' in program pv.cpp:6:1: error: stray '\200' in program pv.cpp:6:1: error: stray '\235' in program pv.cpp:6:1: error: stray '\342' in program pv.cpp:6:1: error: stray '\200' in program pv.cpp:6:1: error: stray '\234' in program pv.cpp: In function 'int main()': pv.cpp:6:34: error: 'a' was not declared in this scope { cin>>n; for(i=1;i<=n;i++) cin>>a[i]; for(i=n;i>=1;i—) cout<<a[i]<<” “; cout<<endl; for(i=1;i<=n;i++) if(a[i]%2==0) s=s+a[i]; cout<<s; cout<<endl; for(i=1;i<=n;i++) if(i%2==0) sp=sp+a[i]; cout<<sp; cout<<endl; for(i=1;i<=n;i++) if(a[i]%10==0) nr=nr+1; cout<<nr; cout<<endl; for(i=1;i<=n;i++) if(a[i]%3==0&&i%2==1) si=si+a[i]; cout<<si; cout<<endl; return 0; ^ pv.cpp:6:53: warning: for increment expression has no effect [-Wunused-value] { cin>>n; for(i=1;i<=n;i++) cin>>a[i]; for(i=n;i>=1;i—) cout<<a[i]<<” “; cout<<endl; for(i=1;i<=n;i++) if(a[i]%2==0) s=s+a[i]; cout<<s; cout<<endl; for(i=1;i<=n;i++) if(i%2==0) sp=sp+a[i]; cout<<sp; cout<<endl; for(i=1;i<=n;i++) if(a[i]%10==0) nr=nr+1; cout<<nr; cout<<endl; for(i=1;i<=n;i++) if(a[i]%3==0&&i%2==1) si=si+a[i]; cout<<si; cout<<endl; return 0; ^ pv.cpp:6:65: error: 'a' was not declared in this scope { cin>>n; for(i=1;i<=n;i++) cin>>a[i]; for(i=n;i>=1;i—) cout<<a[i]<<” “; cout<<endl; for(i=1;i<=n;i++) if(a[i]%2==0) s=s+a[i]; cout<<s; cout<<endl; for(i=1;i<=n;i++) if(i%2==0) sp=sp+a[i]; cout<<sp; cout<<endl; for(i=1;i<=n;i++) if(a[i]%10==0) nr=nr+1; cout<<nr; cout<<endl; for(i=1;i<=n;i++) if(a[i]%3==0&&i%2==1) si=si+a[i]; cout<<si; cout<<endl; return 0; ^ pv.cpp:6:78: error: expected primary-expression before ';' token { cin>>n; for(i=1;i<=n;i++) cin>>a[i]; for(i=n;i>=1;i—) cout<<a[i]<<” “; cout<<endl; for(i=1;i<=n;i++) if(a[i]%2==0) s=s+a[i]; cout<<s; cout<<endl; for(i=1;i<=n;i++) if(i%2==0) sp=sp+a[i]; cout<<sp; cout<<endl; for(i=1;i<=n;i++) if(a[i]%10==0) nr=nr+1; cout<<nr; cout<<endl; for(i=1;i<=n;i++) if(a[i]%3==0&&i%2==1) si=si+a[i]; cout<<si; cout<<endl; return 0; ^ pv.cpp:6:113: error: 'a' was not declared in this scope { cin>>n; for(i=1;i<=n;i++) cin>>a[i]; for(i=n;i>=1;i—) cout<<a[i]<<” “; cout<<endl; for(i=1;i<=n;i++) if(a[i]%2==0) s=s+a[i]; cout<<s; cout<<endl; for(i=1;i<=n;i++) if(i%2==0) sp=sp+a[i]; cout<<sp; cout<<endl; for(i=1;i<=n;i++) if(a[i]%10==0) nr=nr+1; cout<<nr; cout<<endl; for(i=1;i<=n;i++) if(a[i]%3==0&&i%2==1) si=si+a[i]; cout<<si; cout<<endl; return 0; ^ pv.cpp:6:190: error: 'a' was not declared in this scope { cin>>n; for(i=1;i<=n;i++) cin>>a[i]; for(i=n;i>=1;i—) cout<<a[i]<<” “; cout<<endl; for(i=1;i<=n;i++) if(a[i]%2==0) s=s+a[i]; cout<<s; cout<<endl; for(i=1;i<=n;i++) if(i%2==0) sp=sp+a[i]; cout<<sp; cout<<endl; for(i=1;i<=n;i++) if(a[i]%10==0) nr=nr+1; cout<<nr; cout<<endl; for(i=1;i<=n;i++) if(a[i]%3==0&&i%2==1) si=si+a[i]; cout<<si; cout<<endl; return 0; ^ pv.cpp:6:239: error: 'a' was not declared in this scope { cin>>n; for(i=1;i<=n;i++) cin>>a[i]; for(i=n;i>=1;i—) cout<<a[i]<<” “; cout<<endl; for(i=1;i<=n;i++) if(a[i]%2==0) s=s+a[i]; cout<<s; cout<<endl; for(i=1;i<=n;i++) if(i%2==0) sp=sp+a[i]; cout<<sp; cout<<endl; for(i=1;i<=n;i++) if(a[i]%10==0) nr=nr+1; cout<<nr; cout<<endl; for(i=1;i<=n;i++) if(a[i]%3==0&&i%2==1) si=si+a[i]; cout<<si; cout<<endl; return 0; ^ pv.cpp:6:303: error: 'a' was not declared in this scope { cin>>n; for(i=1;i<=n;i++) cin>>a[i]; for(i=n;i>=1;i—) cout<<a[i]<<” “; cout<<endl; for(i=1;i<=n;i++) if(a[i]%2==0) s=s+a[i]; cout<<s; cout<<endl; for(i=1;i<=n;i++) if(i%2==0) sp=sp+a[i]; cout<<sp; cout<<endl; for(i=1;i<=n;i++) if(a[i]%10==0) nr=nr+1; cout<<nr; cout<<endl; for(i=1;i<=n;i++) if(a[i]%3==0&&i%2==1) si=si+a[i]; cout<<si; cout<<endl; return 0; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema pv face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.