#237
Sume
Se dă un şir cu n
numere naturale. Să se afişeze suma primilor n
termeni din şir, apoi suma primilor n-1
termeni din şir, şi aşa mai departe.
Variante Bacalaureat 2009
Problema | Sume | Operații I/O |
![]() sume.in /sume.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #23290813 | Utilizator | |
Fișier | sume.cpp | Dimensiune | 373 B |
Data încărcării | 10 Iunie 2020, 18:51 | Scor / rezultat | Eroare de compilare |
sume.cpp:1:19: warning: extra tokens at end of #include directive [enabled by default] #include <fstream>#include <algorithm>using namespace std; ^ sume.cpp:1:28: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix] #include <fstream>#include <algorithm>using namespace std; ^ sume.cpp:3:1: error: stray '\302' in program int main(){ long int v[10000],i,n,s=0; f>>n; for(i=1;i<=n;i++) { f>>v[i]; s+=v[i]; } g<<s<<'\n'; i=n; while(i!=1) { s-=v[i]; g<<s<<'\n'; --i; } return 0;} ^ sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:3:1: error: stray '\302' in program sume.cpp:3:1: error: stray '\240' in program sume.cpp:2:1: error: 'ifstream' does not name a type ifstream f("sume.in");ofstream g("sume.out"); ^ sume.cpp:2:23: error: 'ofstream' does not name a type ifstream f("sume.in");ofstream g("sume.out"); ^ sume.cpp: In function 'int main()': sume.cpp:3:50: error: 'f' was not declared in this scope int main(){ long int v[10000],i,n,s=0; f>>n; for(i=1;i<=n;i++) { f>>v[i]; s+=v[i]; } g<<s<<'\n'; i=n; while(i!=1) { s-=v[i]; g<<s<<'\n'; --i; } return 0;} ^ sume.cpp:3:138: error: 'g' was not declared in this scope int main(){ long int v[10000],i,n,s=0; f>>n; for(i=1;i<=n;i++) { f>>v[i]; s+=v[i]; } g<<s<<'\n'; i=n; while(i!=1) { s-=v[i]; g<<s<<'\n'; --i; } return 0;} ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Sume 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ă.