#3348
Se dă un număr natural n. Descompuneți numărul n ca sumă de puteri ale lui 2.
| Problema | SumaPuteri2 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64986051 | Utilizator | |
| Fișier | sumaputeri2.c | Dimensiune | 293 B |
| Data încărcării | 04 Iulie 2026, 16:37 | Scor/rezultat | 100 puncte |
sumaputeri2.c: In function ‘pb3348’: sumaputeri2.c:9:8: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 9 | if(n%2==1) | ^~ sumaputeri2.c:11:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 11 | p*=2; | ^ sumaputeri2.c: In function ‘main’: sumaputeri2.c:18:23: warning: unused variable ‘v2’ [-Wunused-variable] 18 | int n,x,y, v[100],v2[100]; | ^~ sumaputeri2.c:18:16: warning: unused variable ‘v’ [-Wunused-variable] 18 | int n,x,y, v[100],v2[100]; | ^ sumaputeri2.c:18:13: warning: unused variable ‘y’ [-Wunused-variable] 18 | int n,x,y, v[100],v2[100]; | ^ sumaputeri2.c:18:11: warning: unused variable ‘x’ [-Wunused-variable] 18 | int n,x,y, v[100],v2[100]; | ^ sumaputeri2.c:18:9: warning: unused variable ‘n’ [-Wunused-variable] 18 | int n,x,y, v[100],v2[100]; | ^ sumaputeri2.c: In function ‘pb3348’: sumaputeri2.c:5:4: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d",&n); | ^~~~~~~~~~~~~~
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | OK. | 20 | 20 | Exemplu | |
| 2 | 0.001 secunde | OK. | 20 | 20 | ||
| 3 | 0 secunde | OK. | 20 | 20 | ||
| 4 | 0.001 secunde | OK. | 20 | 20 | ||
| 5 | 0 secunde | OK. | 20 | 20 | ||
| Punctaj total | 100 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SumaPuteri2 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ă.