#2527
hanoi
Turnurile din Hanoi este un joc matematic sau, dacă vreți, un puzzle. Este format din trei tije A
, B
și C
și un număr variabil de discuri, de diferite diametre. Inițial discurile sunt așezate în ordine descrescătoare a diametrelor pe tija A
, de la vârf către bază, astfel încât să formeze un turn.
Scopul jocului este acela de a muta toate discurile de pe tija A
pe tija C
folosind ca tijă intermediară tija B
, respectând următoarele reguli:
Cerința
Dacă se cunoaște numărul n
de discuri aflate pe tija A
, să se determine șirul mutărilor necesare pentru ca toate discurile să fie mutate pe tija C
.
Problema | hanoi | Operații I/O |
hanoi.in /hanoi.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54909299 | Utilizator | |
Fișier | hanoi.cpp | Dimensiune | 496 B |
Data încărcării | 11 Decembrie 2024, 22:10 | Scor / rezultat | Eroare de compilare |
hanoi.cpp:4:1: error: stray '\342' in program ifstream fin(“hanoi.in”); ^ hanoi.cpp:4:1: error: stray '\200' in program hanoi.cpp:4:1: error: stray '\234' in program hanoi.cpp:4:1: error: stray '\342' in program hanoi.cpp:4:1: error: stray '\200' in program hanoi.cpp:4:1: error: stray '\235' in program hanoi.cpp:5:1: error: stray '\342' in program ofstream fout(“hanoi.out”); ^ hanoi.cpp:5:1: error: stray '\200' in program hanoi.cpp:5:1: error: stray '\234' in program hanoi.cpp:5:1: error: stray '\342' in program hanoi.cpp:5:1: error: stray '\200' in program hanoi.cpp:5:1: error: stray '\235' in program hanoi.cpp:6:1: error: stray '\342' in program char a=‘A’,b=‘B’,c=‘C’; ^ hanoi.cpp:6:1: error: stray '\200' in program hanoi.cpp:6:1: error: stray '\230' in program hanoi.cpp:6:1: error: stray '\342' in program hanoi.cpp:6:1: error: stray '\200' in program hanoi.cpp:6:1: error: stray '\231' in program hanoi.cpp:6:1: error: stray '\342' in program hanoi.cpp:6:1: error: stray '\200' in program hanoi.cpp:6:1: error: stray '\230' in program hanoi.cpp:6:1: error: stray '\342' in program hanoi.cpp:6:1: error: stray '\200' in program hanoi.cpp:6:1: error: stray '\231' in program hanoi.cpp:6:1: error: stray '\342' in program hanoi.cpp:6:1: error: stray '\200' in program hanoi.cpp:6:1: error: stray '\230' in program hanoi.cpp:6:1: error: stray '\342' in program hanoi.cpp:6:1: error: stray '\200' in program hanoi.cpp:6:1: error: stray '\231' in program hanoi.cpp:11:9: error: stray '\342' in program fout<<endl<<A<<“->”<<C; ^ hanoi.cpp:11:9: error: stray '\200' in program hanoi.cpp:11:9: error: stray '\234' in program hanoi.cpp:11:9: error: stray '\342' in program hanoi.cpp:11:9: error: stray '\200' in program hanoi.cpp:11:9: error: stray '\235' in program hanoi.cpp:15:9: error: stray '\342' in program fout<<endl<<A<<“->”<<C; ^ hanoi.cpp:15:9: error: stray '\200' in program hanoi.cpp:15:9: error: stray '\234' in program hanoi.cpp:15:9: error: stray '\342' in program hanoi.cpp:15:9: error: stray '\200' in program hanoi.cpp:15:9: error: stray '\235' in program hanoi.cpp:4:17: error: 'hanoi' was not declared in this scope ifstream fin(“hanoi.in”); ^ hanoi.cpp:5:18: error: 'hanoi' was not declared in this scope ofstream fout(“hanoi.out”); ^ hanoi.cpp:6:11: error: 'A' was not declared in this scope char a=‘A’,b=‘B’,c=‘C’; ^ hanoi.cpp: In function 'void hanoi(int, char, char, char)': hanoi.cpp:11:27: error: expected primary-expression before '->' token fout<<endl<<A<<“->”<<C; ^ hanoi.cpp:11:32: error: expected unqualified-id before '<<' token fout<<endl<<A<<“->”<<C; ^ hanoi.cpp:15:27: error: expected primary-expression before '->' token fout<<endl<<A<<“->”<<C; ^ hanoi.cpp:15:32: error: expected unqualified-id before '<<' token fout<<endl<<A<<“->”<<C; ^ hanoi.cpp: In function 'int main()': hanoi.cpp:25:15: error: 'b' was not declared in this scope hanoi(n,a,b,c); ^ hanoi.cpp:25:17: error: 'c' was not declared in this scope hanoi(n,a,b,c); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema hanoi 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ă.