#1485
Se citește un număr natural n
. Acest număr se “împarte” în alte două numere x
și y
, astfel: x
este format din cifrele din prima jumătate a lui n
, y
este format din cifrele din a doua jumătate a lui n
. Dacă n
are număr impar de cifre, cifra din mijloc va fi prima cifră a lui y
. De exemplu, dacă n=88132
, atunci x=88
, iar y=132
.
Să se determine cel mai mare divizor comun al lui x
și y
.
Olimpiada locală de Informatică, Prahova, 2016
Problema | Jumatate1 | Operații I/O |
![]() jumatate1.in /jumatate1.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58367119 | Utilizator | |
Fișier | jumatate1.cpp | Dimensiune | 647 B |
Data încărcării | 29 Mai 2025, 16:03 | Scor / rezultat | Eroare de compilare |
jumatate1.cpp:7:1: error: expected ',' or ';' before 'long' long long n,x,y,cif,cn,f; ^ jumatate1.cpp: In function 'int main()': jumatate1.cpp:10:11: error: 'n' was not declared in this scope fin >>n; ^ jumatate1.cpp:11:5: error: 'cn' was not declared in this scope cn=n; ^ jumatate1.cpp:13:7: error: 'cif' was not declared in this scope cif++ ; ^ jumatate1.cpp:17:9: error: 'cif' was not declared in this scope if (cif%2==0){ ^ jumatate1.cpp:19:9: error: 'f' was not declared in this scope f=pow(10,cif); ^ jumatate1.cpp:20:9: error: 'y' was not declared in this scope y=n%f; ^ jumatate1.cpp:21:9: error: 'x' was not declared in this scope x=n/f; ^ jumatate1.cpp:25:9: error: 'f' was not declared in this scope f= pow (10,cif) ; ^ jumatate1.cpp:26:10: error: 'y' was not declared in this scope y=n%f; ^ jumatate1.cpp:27:10: error: 'x' was not declared in this scope x=n/f ; ^ jumatate1.cpp:29:16: error: 'x' was not declared in this scope while (x!=y){ ^ jumatate1.cpp:29:19: error: 'y' was not declared in this scope while (x!=y){ ^ jumatate1.cpp:31:13: error: expected ';' before 'else' else y-=x ^ jumatate1.cpp:35:12: error: 'x' was not declared in this scope fout <<x; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Jumatate1 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ă.