#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 | #64854714 | Utilizator | |
| Fișier | jumatate1.cpp | Dimensiune | 763 B |
| Data încărcării | 07 Iunie 2026, 15:19 | Scor/rezultat | 10 puncte |
jumatate1.cpp: In function ‘int main()’: jumatate1.cpp:31:15: warning: ‘x’ may be used uninitialized [-Wmaybe-uninitialized] 31 | x = x * 10 + n % 10; | ~~^~~~ jumatate1.cpp:28:9: note: ‘x’ was declared here 28 | int x,y; | ^ In function ‘int cel_mai_mare_divizor_comun(int, int)’, inlined from ‘int main()’ at jumatate1.cpp:38:44: jumatate1.cpp:7:5: warning: ‘y’ may be used uninitialized [-Wmaybe-uninitialized] 7 | if (b == 0) { | ^~ jumatate1.cpp: In function ‘int main()’: jumatate1.cpp:28:11: note: ‘y’ was declared here 28 | int x,y; | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 0 | 0.002 secunde | Raspuns gresit. | 10 | 0 | ||
| 1 | 0.001 secunde | Raspuns gresit. | 10 | 0 | ||
| 2 | 0.001 secunde | Raspuns gresit. | 10 | 0 | ||
| 3 | 0.001 secunde | Raspuns gresit. | 10 | 0 | ||
| 4 | 0.001 secunde | Raspuns gresit. | 10 | 0 | ||
| 5 | 0.001 secunde | Raspuns gresit. | 10 | 0 | ||
| 6 | 0.002 secunde | OK. | 10 | 10 | ||
| 7 | 0.001 secunde | Raspuns gresit. | 10 | 0 | ||
| 8 | 0.001 secunde | Raspuns gresit. | 10 | 0 | ||
| 9 | 0.001 secunde | Raspuns gresit. | 10 | 0 | ||
| Punctaj total | 10 | |||||
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ă.