#2230
palindrom3
Gigel a învăţat la şcoală un nou cuvânt: palindrom. El ştie acum că un palindrom este o construcţie formată din litere sau/şi cifre care arată la fel citită de la început spre sfârşit sau citită de la sfârşit spre început. De exemplu numerele 2552
și 12321
au proprietatea de palindrom. Deoarece lui Gigel îi place să se joace cu cifrele, el îşi pune următoarea problemă: dat fiind un număr natural, pot fi rearanjate cifrele lui astfel încât să obţinem un palindrom? Dacă da, care este numărul maxim palindrom care poate fi obţinut? Fiind dat un număr natural n
să se determine cel mai mare număr palindrom care se poate obţine cu cifrele numărului n
.
Olimpiada Municipala de Informatica, Iasi, 2008
Problema | palindrom3 | Operații I/O |
palindrom3.in /palindrom3.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54301817 | Utilizator | |
Fișier | palindrom3.cpp | Dimensiune | 750 B |
Data încărcării | 25 Noiembrie 2024, 11:29 | Scor / rezultat | Eroare de compilare |
palindrom3.cpp: In function 'int main()': palindrom3.cpp:8:5: error: reference to 'cin' is ambiguous cin>>n; ^ palindrom3.cpp:4:10: note: candidates are: std::ifstream cin ifstream cin("palindrom3.in"); ^ In file included from palindrom3.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ palindrom3.cpp:8:10: error: 'n' was not declared in this scope cin>>n; ^ palindrom3.cpp:9:5: error: 'clona' was not declared in this scope clona=n; ^ palindrom3.cpp:12:9: error: 'f' was not declared in this scope f[clona%10]++; ^ palindrom3.cpp:15:9: error: 'i' was not declared in this scope for(i=0; i<=9;i++) ^ palindrom3.cpp:17:12: error: 'f' was not declared in this scope if(f[i]%2==1) ^ palindrom3.cpp:18:13: error: 'p' was not declared in this scope p++; ^ palindrom3.cpp:20:8: error: 'p' was not declared in this scope if(p==0) ^ palindrom3.cpp:22:13: error: 'i' was not declared in this scope for(i=9 i>=n;i--) ^ palindrom3.cpp:22:17: error: expected ';' before 'i' for(i=9 i>=n;i--) ^ palindrom3.cpp:22:25: error: expected ';' before ')' token for(i=9 i>=n;i--) ^ palindrom3.cpp:24:17: error: 'j' was not declared in this scope for(j=1;j<=f[i]/2; j++) ^ palindrom3.cpp:24:24: error: 'f' was not declared in this scope for(j=1;j<=f[i]/2; j++) ^ palindrom3.cpp:26:17: error: reference to 'cout' is ambiguous cout<<i; ^ palindrom3.cpp:5:10: note: candidates are: std::ofstream cout ofstream cout("palindrom3.out"); ^ In file included from palindrom3.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ palindrom3.cpp:29:13: error: 'i' was not declared in this scope for(i=0;i<=9;i++) ^ palindrom3.cpp:31:17: error: 'j' was not declared in this scope for(j=1 j<=f[i]/2;j++) ^ palindrom3.cpp:31:21: error: expected ';' before 'j' for(j=1 j<=f[i]/2;j++) ^ palindrom3.cpp:31:34: error: expected ';' before ')' token for(j=1 j<=f[i]/2;j++) ^ palindrom3.cpp:33:17: error: reference to 'cout' is ambiguous cout<<i; ^ palindrom3.cpp:5:10: note: candidates are: std::ofstream cout ofstream cout("palindrom3.out"); ^ In file included from palindrom3.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ palindrom3.cpp:37:8: error: 'p' was not declared in this scope if(p%2==1) ^ palindrom3.cpp:39:13: error: 'i' was not declared in this scope for(i=9;i<=0;i++) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema palindrom3 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ă.