#91
Masini
În curtea unui atelier de reparaţii auto, sunt n
maşini care trebuie sa fie reparate. Deoarece nu sunt suficienţi mecanici, în fiecare moment de timp se poate lucra doar la o singură maşină.
Cunoscând timpul necesar pentru repararea fiecărei maşini, scrieţi un program care calculează numărul maxim de maşini care pot fi reparate într-un interval de timp T
.
Problema | Masini | Operații I/O |
![]() masini.in /masini.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #25799579 | Utilizator | |
Fișier | masini.cpp | Dimensiune | 422 B |
Data încărcării | 16 Noiembrie 2020, 11:32 | Scor / rezultat | Eroare de compilare |
masini.cpp:3:1: error: 'usingnamespacestd' does not name a type usingnamespacestd; ^ masini.cpp:4:1: error: 'ifstream' does not name a type ifstream in("masini.in"); ^ masini.cpp:5:1: error: 'ofstream' does not name a type ofstream out("masini.out"); ^ masini.cpp:6:9: error: ISO C++ forbids declaration of 'intmain' with no type [-fpermissive] intmain(){int n,t,s=0,v[10001]; ^ masini.cpp: In function 'int intmain()': masini.cpp:7:11: error: 'in' was not declared in this scope in>>n>>t; ^ masini.cpp:8:15: error: 'inti' was not declared in this scope for(inti=0; i<n; i++) ^ masini.cpp:8:23: error: 'i' was not declared in this scope for(inti=0; i<n; i++) ^ masini.cpp:10:5: error: 'inti' was not declared in this scope for(inti=0; i<n-1; i++) ^ masini.cpp:10:13: error: 'i' was not declared in this scope for(inti=0; i<n-1; i++) ^ masini.cpp:11:9: error: 'intj' was not declared in this scope for(intj=i+1; j<n; j++) ^ masini.cpp:11:19: error: 'j' was not declared in this scope for(intj=i+1; j<n; j++) ^ masini.cpp:13:20: error: 'swap' was not declared in this scope swap(v[i], v[j]); ^ masini.cpp:13:20: note: suggested alternatives: In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from masini.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: 'std::swap' swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ In file included from /usr/include/c++/4.8/exception:152:0, from /usr/include/c++/4.8/ios:39, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from masini.cpp:1: /usr/include/c++/4.8/bits/exception_ptr.h:160:5: note: 'std::__exception_ptr::swap' swap(exception_ptr& __lhs, exception_ptr& __rhs) ^ masini.cpp:18:11: error: 'out' was not declared in this scope out<<s; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Masini 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ă.