#318
Se dau n numere naturale. Determinaţi o aranjare a acestor numere pe un cerc, astfel încât suma produselor de câte două numere vecine să fie maximă.
| Problema | Cerc | Operații I/O |
cerc.in/cerc.out
|
|---|---|---|---|
| Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64499073 | Utilizator | |
| Fișier | cerc.cpp | Dimensiune | 1.30 KB |
| Data încărcării | 11 Mai 2026, 12:48 | Scor/rezultat | Eroare de compilare |
cerc.cpp:4:6: error: expected ‘,’ or ‘;’ before ‘ofstream’ 4 | ofstream cout("cerc.out") | ^~~~~~~~ cerc.cpp: In function ‘void afisare()’: cerc.cpp:11:16: error: ‘v’ was not declared in this scope 11 | int suma = v[s[1]]*v[s[n]]; | ^ cerc.cpp:11:18: error: ‘s’ was not declared in this scope 11 | int suma = v[s[1]]*v[s[n]]; | ^ cerc.cpp:11:28: error: ‘n’ was not declared in this scope 11 | int suma = v[s[1]]*v[s[n]]; | ^ cerc.cpp:17:9: error: ‘cout’ was not declared in this scope 17 | cout<<v[s[i]]<<" "; | ^~~~ cerc.cpp:2:1: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? 1 | #include<fstream> +++ |+#include <iostream> 2 | using namespace std; cerc.cpp:23:5: error: ‘cout’ was not declared in this scope 23 | cout<<v[s[n]]<<" suma: "; | ^~~~ cerc.cpp:23:5: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? cerc.cpp:26:8: error: ‘sum’ was not declared in this scope; did you mean ‘suma’? 26 | if(sum>summax) | ^~~ | suma cerc.cpp:26:12: error: ‘summax’ was not declared in this scope; did you mean ‘suma’? 26 | if(sum>summax) | ^~~~~~ | suma cerc.cpp:31:13: error: ‘sol’ was not declared in this scope 31 | sol[i]=v[s[i]]; | ^~~ cerc.cpp: In function ‘void back(int)’: cerc.cpp:41:11: error: ‘n’ was not declared in this scope 41 | if(k==n+1) | ^ cerc.cpp:53:13: error: ‘s’ was not declared in this scope 53 | s[k] = i; | ^ cerc.cpp:55:16: error: ‘f’ was not declared in this scope 55 | if(f[i]==0) | ^ cerc.cpp: In function ‘int main()’: cerc.cpp:77:10: error: ‘n’ was not declared in this scope 77 | cin>>n; | ^ cerc.cpp:83:14: error: ‘v’ was not declared in this scope 83 | cin>>v[i]; | ^ cerc.cpp:93:16: error: ‘v’ was not declared in this scope 93 | if(v[i]>v[j]) | ^ cerc.cpp:105:5: error: ‘s’ was not declared in this scope 105 | s[1]=1; | ^ cerc.cpp:107:5: error: ‘f’ was not declared in this scope 107 | f[1]=1; | ^ cerc.cpp:111:9: error: ‘cout’ was not declared in this scope 111 | cout<<sol[i]<<" "; | ^~~~ cerc.cpp:111:9: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? cerc.cpp:111:15: error: ‘sol’ was not declared in this scope 111 | cout<<sol[i]<<" "; | ^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Cerc 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ă.