#2013
numere18
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 | #51061284 | Utilizator | |
Fișier | numere18.cpp | Dimensiune | 435 B |
Data încărcării | 21 Mai 2024, 20:17 | Scor / rezultat | Eroare de compilare |
numere18.cpp: In function 'int main()': numere18.cpp:9:5: error: 'f' was not declared in this scope f>> c; ^ numere18.cpp:9:9: error: 'c' was not declared in this scope f>> c; ^ numere18.cpp:12:12: error: 'n' was not declared in this scope f>>n; ^ numere18.cpp:13:9: error: 'pt' was not declared in this scope pt=n*(n-1)/2+1; ^ numere18.cpp:14:9: error: 'ut' was not declared in this scope ut=pt+n-1; ^ numere18.cpp:15:9: error: 's' was not declared in this scope s=(pt+ut)*n/2; ^ numere18.cpp:16:9: error: 'g' was not declared in this scope g<<s; ^ numere18.cpp:20:12: error: 'm' was not declared in this scope f>>m; ^ numere18.cpp:21:9: error: 'n' was not declared in this scope n=(1+int(sqrt(8*m-7)))/2; ^ numere18.cpp:21:28: error: 'sqrt' was not declared in this scope n=(1+int(sqrt(8*m-7)))/2; ^ numere18.cpp:22:9: error: 'pt' was not declared in this scope pt=n*(n-1)/2+1; ^ numere18.cpp:23:9: error: 'poz' was not declared in this scope poz=m-pt+1; ^ numere18.cpp:24:9: error: 'g' was not declared in this scope g<<n<<" "<<poz<<endl; ^
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ă.