#4521
HarapAlb3
După numeroase aventuri, Harap Alb, însoțit de gașca de prieteni adunați de pe drum (Gerilă, Flămânzilă, Setilă, Ochilă și Păsări-Lăţi-Lungilă) ajung la împăratul Roș, având ca target fata acestuia. Acolo primesc mai multe challenge-uri, pe care le rezolvă cu o dexteritate specifică unor gamer-i cu experiență, dar povestea evită să prezinte ultimul challenge, care le-a pus probleme serioase.
Se pare că fata împăratului Roș i-a dat lui Harap Alb un număr natural scris cu patru cifre și i-a cerut să determine cel mai mare număr scris cu două cifre vecine din numărul dat.
Problema | HarapAlb3 | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58580742 | Utilizator | |
Fișier | harapalb3.cpp | Dimensiune | 519 B |
Data încărcării | 23 Iunie 2025, 22:31 | Scor / rezultat | Eroare de compilare |
harapalb3.cpp: In function 'int main()': harapalb3.cpp:12:8: error: overloaded function with no contextual type information max=-1; ^ harapalb3.cpp:13:12: error: the value of 'u' is not usable in a constant expression if(max<u) max=u; ^ harapalb3.cpp:8:9: note: 'int u' is not const int u=n%10; ^ harapalb3.cpp:13:8: error: parse error in template argument list if(max<u) max=u; ^ harapalb3.cpp:13:13: error: cannot resolve overloaded function 'max' based on conversion to type 'bool' if(max<u) max=u; ^ harapalb3.cpp:13:18: error: overloaded function with no contextual type information if(max<u) max=u; ^ harapalb3.cpp:14:12: error: the value of 'z' is not usable in a constant expression if(max<z) max=z; ^ harapalb3.cpp:9:9: note: 'int z' is not const int z=n/10%10; ^ harapalb3.cpp:14:8: error: parse error in template argument list if(max<z) max=z; ^ harapalb3.cpp:14:13: error: cannot resolve overloaded function 'max' based on conversion to type 'bool' if(max<z) max=z; ^ harapalb3.cpp:14:18: error: overloaded function with no contextual type information if(max<z) max=z; ^ harapalb3.cpp:15:12: error: the value of 's' is not usable in a constant expression if(max<s) max=s; ^ harapalb3.cpp:10:9: note: 'int s' is not const int s=n/100%10; ^ harapalb3.cpp:15:8: error: parse error in template argument list if(max<s) max=s; ^ harapalb3.cpp:15:13: error: cannot resolve overloaded function 'max' based on conversion to type 'bool' if(max<s) max=s; ^ harapalb3.cpp:15:18: error: overloaded function with no contextual type information if(max<s) max=s; ^ harapalb3.cpp:16:12: error: the value of 'm' is not usable in a constant expression if(max<m) max=m; ^ harapalb3.cpp:11:9: note: 'int m' is not const int m=n/1000; ^ harapalb3.cpp:16:8: error: parse error in template argument list if(max<m) max=m; ^ harapalb3.cpp:16:13: error: cannot resolve overloaded function 'max' based on conversion to type 'bool' if(max<m) max=m; ^ harapalb3.cpp:16:18: error: overloaded function with no contextual type information if(max<m) max=m; ^ harapalb3.cpp:17:13: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator==' if(max==u) cout<<u*10+z; ^ harapalb3.cpp:18:13: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator==' if(max==z) ^ harapalb3.cpp:23:13: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator==' if(max==s) ^ harapalb3.cpp:28:13: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator==' if(max==m) cout<<m*10+s; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema HarapAlb3 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ă.