#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 | #64812754 | Utilizator | |
| Fișier | numere18.cpp | Dimensiune | 305 B |
| Data încărcării | 02 Iunie 2026, 23:12 | Scor/rezultat | 0 puncte |
numere18.cpp: In function ‘int main()’: numere18.cpp:12:18: warning: ‘a’ may be used uninitialized [-Wmaybe-uninitialized] 12 | if(c==2) {f>>m; l=b-a;} g<<l<<" "<<m-(l-1)*l/2; | ~^~~~ numere18.cpp:6:19: note: ‘a’ was declared here 6 | int n,m, s, c, l, a, b; | ^ numere18.cpp:12:18: warning: ‘b’ may be used uninitialized [-Wmaybe-uninitialized] 12 | if(c==2) {f>>m; l=b-a;} g<<l<<" "<<m-(l-1)*l/2; | ~^~~~ numere18.cpp:6:22: note: ‘b’ was declared here 6 | int n,m, s, c, l, a, b; | ^ numere18.cpp:12:31: warning: ‘l’ may be used uninitialized [-Wmaybe-uninitialized] 12 | if(c==2) {f>>m; l=b-a;} g<<l<<" "<<m-(l-1)*l/2; | ^~~ numere18.cpp:6:16: note: ‘l’ was declared here 6 | int n,m, s, c, l, a, b; | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.003 secunde | Raspuns gresit. | 5 | 0 | Exemplu | |
| 2 | 0.001 secunde | Raspuns gresit. | 5 | 0 | Exemplu | |
| 3 | 0.001 secunde | Raspuns gresit. | 5 | 0 | ||
| 4 | 0.001 secunde | Raspuns gresit. | 5 | 0 | ||
| 5 | 0.001 secunde | Raspuns gresit. | 5 | 0 | ||
| 6 | 0.001 secunde | Raspuns gresit. | 5 | 0 | ||
| 7 | 0.002 secunde | Raspuns gresit. | 10 | 0 | ||
| 8 | 0.002 secunde | Raspuns gresit. | 10 | 0 | ||
| 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 | 0 | |||||
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ă.