#1233
Paint
Roberto are suflet de artist. El visează să ajungă într-o bună zi un pictor celebru, dar pentru moment își câştigă existența ca zugrav.
Roberto a primit sarcina de a zugrăvi un zid având lungimea n
metri şi înălţimea un metru. Pentru aceasta are la dispoziţie m
zile. În fiecare zi i
, el acoperă cu un singur strat de vopsea o porţiune compactă de înălțime un metru și de lungime l[i]
metri, începând de la distanţa d[i]
metri faţă de capătul din stânga al zidului.
Roberto ştie din experienţă că fiecare porţiune de zid trebuie acoperită cu cel puţin K
straturi de vopsea pentru ca stratul final de vopsea să aibă consistenţa dorită. Din nefericire, firea lui de artist nu i-a permis să-şi poată planifica munca în mod optim, astfel că la capătul celor m
zile de efort, Roberto a constatat că zidul are porţiuni pe care le-a acoperit de mai mult de k
ori şi alte porţiuni pe care le-a acoperit de mai puţin de k
ori.
Pentru a recupera în proprii săi ochi dar mai ales în ochii şefului de echipă, el trebuie să afle mai întâi suprafaţa totală a tuturor porţiunilor de zid care mai trebuie zugrăvite.
Cunoscând lungimea zidului n
, numărul de zile m
şi porţiunile compacte pe care le zugrăveşte în fiecare zi, determinaţi suprafaţa totală a zidului care mai trebuie zugrăvită.
Lot Juniori, Valcea, 2015
Problema | Paint | Operații I/O |
paint.in /paint.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 8 MB
/
Stivă 8 MB
|
Id soluție | #53732015 | Utilizator | |
Fișier | paint.cpp | Dimensiune | 393 B |
Data încărcării | 10 Noiembrie 2024, 10:31 | Scor / rezultat | Eroare de compilare |
paint.cpp: In function 'int main()': paint.cpp:21:9: error: no match for 'operator<<' (operand types are 'std::ifstream {aka std::basic_ifstream<char>}' and 'int') cout<<a; ^ paint.cpp:21:9: note: candidates are: 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 paint.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2753:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) operator<<(basic_ostream<_CharT, _Traits>& __os, ^ /usr/include/c++/4.8/bits/basic_string.h:2753:5: note: template argument deduction/substitution failed: paint.cpp:21:11: note: 'std::ifstream {aka std::basic_ifstream<char>}' is not derived from 'std::basic_ostream<_CharT, _Traits>' cout<<a; ^ In file included from /usr/include/c++/4.8/istream:39:0, from /usr/include/c++/4.8/fstream:38, from paint.cpp:1: /usr/include/c++/4.8/ostream:471:5: note: template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, _CharT) operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) ^ /usr/include/c++/4.8/ostream:471:5: note: template argument deduction/substitution failed: paint.cpp:21:11: note: 'std::ifstream {aka std::basic_ifstream<char>}' is not derived from 'std::basic_ostream<_CharT, _Traits>' cout<<a; ^ In file included from /usr/include/c++/4.8/istream:39:0, from /usr/include/c++/4.8/fstream:38, from paint.cpp:1: /usr/include/c++/4.8/ostream:476:5: note: template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, char) operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) ^ /usr/include/c++/4.8/ostream:476:5: note: template argument deduction/substitution failed: paint.cpp:21:11: note: 'std::ifstream {aka std::basic_ifstream<char>}' is not derived from 'std::basic_ostream<_CharT, _Traits>' cout<<a; ^ In file included from /usr/include/c++/4.8/istream:39:0, from /usr/include/c++/4.8/fstream:38, from paint.cpp:1: /usr/include/c++/4.8/ostream:482:5: note: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, char) operator<<(basic_ostream<char, _Traits>& __out, char __c) ^ /usr/include/c++/4.8/ostream:482:5: note: template argument deduction/substitution failed: paint.cpp:21:11: note: 'std::ifstream {aka std::basic_ifstream<char>}' is not derived from 'std::basic_ostream<char, _Traits>' cout<<a; ^ In file included from /usr/include/c++/4.8/istream:39:0, from /usr/include/c++/4.8/fstream:38, from paint.cpp:1: /usr/include/c++/4.8/ostream:488:5: note: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, signed char) operator<<(basic_ostream<char, _Traits>& __out, signed char __c) ^ /usr/include/c++/4.8/ostream:488:5: note: template argument deduction/substitution failed: paint.cpp:21:11: note: 'std::ifstream {aka std::basic_ifstream<char>}' is not derived from 'std::basic_ostream<char, _Traits>' cout<<a; ^ In file included from /usr/include/c++/4.8/istream:39:0, from /usr/include/c++/4.8/fstream:38, from paint.cpp:1: /usr/include/c++/4.8/ostream:493:5: note: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, unsigned char) operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) ^ /usr/include/c++/4.8/ostream:493:5: note: template argument deduction/substitution failed: paint.cpp:21:11: note: 'std::ifstream {aka std::basic_ifstream<char>}' is not derived from 'std::basic_ostream<char, _Traits>' cout<<a; ^ In file included from /usr/include/c++/4.8/istream:39:0, from /usr/include/c++/4.8/fstream:38, from paint.cpp:1: /usr/include/c++/4.8/ostream:513:5: note: template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const _CharT*) operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) ^ /usr/include/c++/4.8/ostream:513:5: note: template argument deduction/substitution failed: paint.cpp:21:11: note: 'std::ifstream {aka std::basic_ifstream<char>}' is not derived from 'std::basic_ostream<_CharT, _Traits>' cout<<a; ^ In file included from /usr/include/c++/4.8/ostream:612:0, from /usr/include/c++/4.8/istream:39, from /usr/include/c++/4.8/fstream:38, from paint.cpp:1: /usr/include/c++/4.8/bits/ostream.tcc:321:5: note: template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const char*) operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) ^ /usr/include/c++/4.8/bits/ostream.tcc:321:5: note: template argument deduction/substitution failed: paint.cpp:21:11: note: 'std::ifstream {aka std::basic_ifstream<char>}' is not derived from 'std::basic_ostream<_CharT, _Traits>' cout<<a; ^ In file included from /usr/include/c++/4.8/istream:39:0, from /usr/include/c++/4.8/fstream:38, from paint.cpp:1: /usr/include/c++/4.8/ostream:530:5: note: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const char*) operator<<(basic_ostream<char, _Traits>& __out, const char* __s) ^ /usr/include/c++/4.8/ostream:530:5: note: template argument deduction/substitution failed: paint.cpp:21:11: note: 'std::ifstream {aka std::basic_ifstream<char>}' is not derived from 'std::basic_ostream<char, _Traits>' cout<<a; ^ In file included from /usr/include/c++/4.8/istream:39:0, from /usr/include/c++/4.8/fstream:38, from paint.cpp:1: /usr/include/c++/4.8/ostream:543:5: note: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const signed char*) operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s) ^ /usr/include/c++/4.8/ostream:543:5: note: template argument deduction/substitution failed: paint.cpp:21:11: note: 'std::ifstream {aka std::basic_ifstream<char>}' is not derived from 'std::basic_ostream<char, _Traits>' cout<<a; ^ In file included from /usr/include/c++/4.8/istream:39:0, from /usr/include/c++/4.8/fstream:38, from paint.cpp:1: /usr/include/c++/4.8/ostream:548:5: note: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const unsigned char*) operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s) ^ /usr/include/c++/4.8/ostream:548:5: note: template argument deduction/substitution failed: paint.cpp:21:11: note: 'std::ifstream {aka std::basic_ifstream<char>}' is not derived from 'std::basic_ostream<char, _Traits>' cout<<a; ^ In file included from /usr/include/c++/4.8/istream:39:0, from /usr/include/c++/4.8/fstream:38, from paint.cpp:1: /usr/include/c++/4.8/ostream:602:5: note: template<class _CharT, class _Traits, class _Tp> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x) ^ /usr/include/c++/4.8/ostream:602:5: note: template argument deduction/substitution failed: paint.cpp:21:11: note: 'std::ifstream {aka std::basic_ifstream<char>}' is not derived from 'std::basic_ostream<_CharT, _Traits>' cout<<a; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Paint 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ă.