#1773
Happy
C++
Lui Ionci ii place foarte mult matematica si informatica, asa ca s-a gandit sa creeze o operatie. Aceasta a numit-o "Happy"
, notata cu semnul ☺
. Operatia se aplica doar numerelor naturale si dau ca rezultat tot un numar natural, conform exemplelor de mai jos:
2010 ☺ 2005 = 5
78 ☺ 54 = 6
999 ☺ 543 = 3
4 ☺ 9 = 1
5 ☺ 6 = 1
32 ☺ 24 = 8
10 ☺ 2 = 2
Profesorul de matematica, Vasy, i-a promis nota 10 pe invenție dacă pentru mai multe perechi de numere naturale veți determina cel mai mic număr rezultat cu număr par de divizori al operației Happy
aplicată perechilor date și cel mai mare număr rezultat al operației Happy
cu număr impar de divizori.
Problema | Happy | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0 secunde | Limita memorie |
Total: 0.1 MB
/
Stivă 0.1 MB
|
Id soluție | #19429793 | Utilizator | |
Fișier | happy.cpp | Dimensiune | 547 B |
Data încărcării | 08 Decembrie 2019, 10:24 | Scor / rezultat | Eroare de compilare |
happy.cpp:1:1: error: 'var' does not name a type var n,a,b:longint; ^ happy.cpp:2:1: error: 'function' does not name a type function divizor(a:longint):longint; ^ happy.cpp:3:1: error: 'var' does not name a type var r,b,i:longint; ^ happy.cpp:4:1: error: 'begin' does not name a type begin ^ happy.cpp:6:5: error: expected unqualified-id before 'for' for i:=2 to round(sqrt(a)) do ^ happy.cpp:10:16: error: 'b' does not name a type r:=r+1;b:=a div i; ^ happy.cpp:11:9: error: expected unqualified-id before 'if' if(a mod b=0)and(b>sqrt(a)) then r:=r+1; ^ happy.cpp:12:5: error: 'end' does not name a type end; ^ happy.cpp:13:1: error: 'end' does not name a type end; ^ happy.cpp:14:1: error: 'divizor' does not name a type divizor:=r; ^ happy.cpp:15:1: error: 'end' does not name a type end; ^ happy.cpp:16:1: error: 'function' does not name a type function cmmdc(a,b:longint):longint; ^ happy.cpp:17:1: error: 'var' does not name a type var r:longint; ^ happy.cpp:18:1: error: 'begin' does not name a type begin ^ happy.cpp:22:9: error: 'a' does not name a type a:=b; ^ happy.cpp:23:9: error: 'b' does not name a type b:=r; ^ happy.cpp:24:5: error: 'end' does not name a type end; ^ happy.cpp:25:5: error: 'cmmdc' does not name a type cmmdc:=a; ^ happy.cpp:27:1: error: 'end' does not name a type end; ^ happy.cpp:28:1: error: 'begin' does not name a type begin ^ happy.cpp:30:20: error: expected constructor, destructor, or type conversion before '(' token writeln(divizor(1024)); ^ happy.cpp:31:1: error: 'end' does not name a type end. ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Happy 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ă.