#318
Cerc
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 | #5925962 | Utilizator | |
Fișier | cerc.cpp | Dimensiune | 1006 B |
Data încărcării | 04 Octombrie 2017, 12:37 | Scor / rezultat | Eroare de compilare |
cerc.cpp:4:11: error: expected unqualified-id before string constant ifstream ("cerc.in") ^ cerc.cpp:4:11: error: expected ')' before string constant cerc.cpp: In function 'int init(int)': cerc.cpp:9:5: error: 'sol' was not declared in this scope sol[k]=0; ^ cerc.cpp:10:5: warning: no return statement in function returning non-void [-Wreturn-type] } ^ cerc.cpp: In function 'int succesor(int)': cerc.cpp:13:8: error: 'sol' was not declared in this scope if(sol[k]<n) ^ cerc.cpp:13:15: error: 'n' was not declared in this scope if(sol[k]<n) ^ cerc.cpp: In function 'int valid(int)': cerc.cpp:23:1: error: 'sol' was not declared in this scope sol[k+1]=sol[1]; ^ cerc.cpp: In function 'int solutie(int)': cerc.cpp:30:15: error: 'n' was not declared in this scope return k==n+1; ^ cerc.cpp: In function 'void tipar()': cerc.cpp:36:20: error: 'n' was not declared in this scope for(int i=1;i<=n+1;i++) ^ cerc.cpp:37:15: error: 'v' was not declared in this scope suma=suma+v[sol[i]] * v[sol[i+1]]; ^ cerc.cpp:37:17: error: 'sol' was not declared in this scope suma=suma+v[sol[i]] * v[sol[i+1]]; ^ cerc.cpp:38:13: error: 'summax' was not declared in this scope if(suma>summax) ^ cerc.cpp:41:21: error: 'n' was not declared in this scope for(int i=1;i<=n;i++) ^ cerc.cpp:42:13: error: 'a' was not declared in this scope a[i]=v[sol[i]]; ^ cerc.cpp:42:18: error: 'v' was not declared in this scope a[i]=v[sol[i]]; ^ cerc.cpp:42:20: error: 'sol' was not declared in this scope a[i]=v[sol[i]]; ^ cerc.cpp: In function 'int main()': cerc.cpp:60:5: error: 'f' was not declared in this scope f>>n; ^ cerc.cpp:60:8: error: 'n' was not declared in this scope f>>n; ^ cerc.cpp:61:32: error: 'v' was not declared in this scope for(int i=1;i<=n;i++) cin>>v[i]; ^ cerc.cpp:64:9: error: 'g' was not declared in this scope g<<a[i]<<" "; ^ cerc.cpp:64:12: error: 'a' was not declared in this scope g<<a[i]<<" "; ^ cerc.cpp: In function 'int succesor(int)': cerc.cpp:20:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cerc.cpp: In function 'int solutie(int)': cerc.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
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ă.