#2014
Canguri
La proba de atletism s-au calificat trei canguri care trebuie să efectueze sărituri pe o pistă de 800 metri.
Fiecare cangur se aliniază la linia de start, îşi lipeşte pe marsupiu eticheta cu numărul său de concurs iar apoi când se dă stratul efectuează săritură după săritură până trece linia de sosire.
Cunoscând lungimea săriturii fiecărui cangur (exprimată în metri) şi faptul că nu există doi canguri cu sărituri de aceeaşi lungime, scrieți un program care să determine:
a) Numărul de concurs al cangurului care ajunge primul la linia de sosire;
b) Numărul săriturilor efectuate de cangurul care a trecut primul linia de sosire.
Problema | Canguri | Operații I/O |
canguri.in /canguri.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #49442966 | Utilizator | |
Fișier | canguri.cpp | Dimensiune | 491 B |
Data încărcării | 01 Martie 2024, 20:29 | Scor / rezultat | Eroare de compilare |
canguri.cpp: In function 'int main()': canguri.cpp:5:1: error: 'ifstream' was not declared in this scope ifstream cin("canguri.in") ^ canguri.cpp:5:1: note: suggested alternative: In file included from /usr/include/c++/4.8/ios:38:0, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from canguri.cpp:1: /usr/include/c++/4.8/iosfwd:157:34: note: 'std::ifstream' typedef basic_ifstream<char> ifstream; ^ canguri.cpp:5:10: error: expected ';' before 'cin' ifstream cin("canguri.in") ^ canguri.cpp:7:1: error: 'ofstream' was not declared in this scope ofstream cout("canguri.out"); ^ canguri.cpp:7:1: note: suggested alternative: In file included from /usr/include/c++/4.8/ios:38:0, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from canguri.cpp:1: /usr/include/c++/4.8/iosfwd:160:34: note: 'std::ofstream' typedef basic_ofstream<char> ofstream; ^ canguri.cpp:7:10: error: expected ';' before 'cout' ofstream cout("canguri.out"); ^ canguri.cpp:10:5: error: 'cout' was not declared in this scope cout<<a<<endl; ^ canguri.cpp:10:14: error: 'endl' was not declared in this scope cout<<a<<endl; ^ canguri.cpp:10:14: note: suggested alternative: In file included from /usr/include/c++/4.8/istream:39:0, from /usr/include/c++/4.8/fstream:38, from canguri.cpp:1: /usr/include/c++/4.8/ostream:564:5: note: 'std::endl' endl(basic_ostream<_CharT, _Traits>& __os) ^ canguri.cpp:18:5: error: 'cout' was not declared in this scope cout<<b<<endl; ^ canguri.cpp:18:14: error: 'endl' was not declared in this scope cout<<b<<endl; ^ canguri.cpp:18:14: note: suggested alternative: In file included from /usr/include/c++/4.8/istream:39:0, from /usr/include/c++/4.8/fstream:38, from canguri.cpp:1: /usr/include/c++/4.8/ostream:564:5: note: 'std::endl' endl(basic_ostream<_CharT, _Traits>& __os) ^ canguri.cpp:24:5: error: 'cout' was not declared in this scope cout<<c<<endl; ^ canguri.cpp:24:14: error: 'endl' was not declared in this scope cout<<c<<endl; ^ canguri.cpp:24:14: note: suggested alternative: In file included from /usr/include/c++/4.8/istream:39:0, from /usr/include/c++/4.8/fstream:38, from canguri.cpp:1: /usr/include/c++/4.8/ostream:564:5: note: 'std::endl' endl(basic_ostream<_CharT, _Traits>& __os) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Canguri 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ă.