#2013
Numerele naturale nenule se scriu pe linii într-un triunghi de forma de mai jos:
1 2 3 4 5 6 7 8 9 10 ...
Se dau două numere natural n și m. Determinați:
1. Suma numerelor de pe linia cu numărul n din triunghiul construit ca mai sus.
2. Linia pe care se află numărul m precum și pe ce poziție se află el pe această linie.
| Problema | numere18 | Operații I/O |
numere18.in/numere18.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64812871 | Utilizator | |
| Fișier | numere18.cpp | Dimensiune | 336 B |
| Data încărcării | 02 Iunie 2026, 23:27 | Scor/rezultat | 45 puncte |
numere18.cpp: In function ‘int main()’: numere18.cpp:11:1: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 11 | for(int i=a+1; i<=b; i++) | ^~~ numere18.cpp:12:12: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 12 | s=s+i; g<<s;} | ^ numere18.cpp:14:1: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation] 14 | while((k-1)*k/2<m) | ^~~~~ numere18.cpp:15:10: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’ 15 | k++; g<<k<<" "<<m-k*(k-1)/2;} | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | OK. | 5 | 5 | Exemplu | |
| 2 | 0.001 secunde | Raspuns gresit. | 5 | 0 | Exemplu | |
| 3 | 0.001 secunde | OK. | 5 | 5 | ||
| 4 | 0.001 secunde | OK. | 5 | 5 | ||
| 5 | 0.001 secunde | OK. | 5 | 5 | ||
| 6 | 0.001 secunde | OK. | 5 | 5 | ||
| 7 | 0.001 secunde | OK. | 10 | 10 | ||
| 8 | 0.001 secunde | OK. | 10 | 10 | ||
| 9 | 0.001 secunde | Raspuns gresit. | 5 | 0 | ||
| 10 | 0.001 secunde | Raspuns gresit. | 5 | 0 | ||
| 11 | 0.001 secunde | Raspuns gresit. | 5 | 0 | ||
| 12 | 0.001 secunde | Raspuns gresit. | 5 | 0 | ||
| 13 | 0.001 secunde | Raspuns gresit. | 10 | 0 | ||
| 14 | 0.001 secunde | Raspuns gresit. | 10 | 0 | ||
| 15 | 0.001 secunde | Raspuns gresit. | 10 | 0 | ||
| Punctaj total | 45 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema numere18 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ă.