#1222
TV
Comisia Naţională a Audiovizualului (CNA) este autoritatea care coordonează activitatea posturilor media din România. Șeful CNA-ului dorește o statistică referitoare la publicitatea transmisă de posturile de televiziune. În acest scop, el primește pentru fiecare zi informații în următorul format: d hh:mm:ss
, unde d
este durata exprimată în secunde a publicității, iar hh:mm:ss
este momentul de start al publicității (hh
este ora, mm
este minutul, iar ss
este secunda). Observaţi că d
este separat de hh
printr-un singur spaţiu, iar următoarele valori sunt separate prin caracterul ':'
.
De exemplu o linie de forma:
150 05:02:45
se interpretează astfel: există un post TV care a transmis publicitate cu durata de 150
secunde, ora de început fiind 5
, 2
minute și 45
de secunde.
”Secunda de aur” este o secundă în care se difuzează cât mai multă publicitate, adică pe un număr maxim de posturi în acea secundă se transmite publicitate. Dacă sunt mai multe astfel de secunde, “secunda de aur” este considerată prima secundă cu această proprietate în derularea zilei.
Șeful CNA primește în fiecare dimineață lista cu activitatea din ziua anterioară ca o succesiune de linii, fiecare linie având forma descrisă mai sus.
Scrieţi un program care, cunoscând lista din ziua anterioară, să rezolve următoarele cerinţe:
ONI GIM 2015, Clasa a VII-a
Problema | TV | Operații I/O |
![]() tv.in /tv.out
|
---|---|---|---|
Limita timp | 0.08 secunde | Limita memorie |
Total: 4 MB
/
Stivă 2 MB
|
Id soluție | #51653338 | Utilizator | |
Fișier | tv.cpp | Dimensiune | 1.88 KB |
Data încărcării | 28 Iulie 2024, 18:40 | Scor / rezultat | Eroare de compilare |
tv.cpp: In function 'int main()': tv.cpp:14:5: error: reference to 'cin' is ambiguous cin >> c >> n; ^ tv.cpp:5:10: note: candidates are: std::ifstream cin ifstream cin("tv.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from tv.cpp:2: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ tv.cpp:19:9: error: reference to 'cin' is ambiguous cin >> nr >> s; ^ tv.cpp:5:10: note: candidates are: std::ifstream cin ifstream cin("tv.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from tv.cpp:2: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ tv.cpp:51:13: error: reference to 'cout' is ambiguous cout << h << ':'; ^ tv.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("tv.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from tv.cpp:2: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ tv.cpp:53:13: error: reference to 'cout' is ambiguous cout << 0 << h << ':'; ^ tv.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("tv.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from tv.cpp:2: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ tv.cpp:55:13: error: reference to 'cout' is ambiguous cout << m << ':'; ^ tv.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("tv.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from tv.cpp:2: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ tv.cpp:57:13: error: reference to 'cout' is ambiguous cout << 0 << m << ':'; ^ tv.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("tv.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from tv.cpp:2: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ tv.cpp:59:13: error: reference to 'cout' is ambiguous cout << s; ^ tv.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("tv.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from tv.cpp:2: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ tv.cpp:61:13: error: reference to 'cout' is ambiguous cout << 0 << s; ^ tv.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("tv.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from tv.cpp:2: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ tv.cpp:76:13: error: reference to 'cout' is ambiguous cout << h << ':'; ^ tv.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("tv.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from tv.cpp:2: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ tv.cpp:78:13: error: reference to 'cout' is ambiguous cout << 0 << h << ':'; ^ tv.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("tv.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from tv.cpp:2: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ tv.cpp:80:13: error: reference to 'cout' is ambiguous cout << m << ':'; ^ tv.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("tv.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from tv.cpp:2: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ tv.cpp:82:13: error: reference to 'cout' is ambiguous cout << 0 << m << ':'; ^ tv.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("tv.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from tv.cpp:2: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ tv.cpp:84:13: error: reference to 'cout' is ambiguous cout << s; ^ tv.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("tv.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from tv.cpp:2: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ tv.cpp:86:13: error: reference to 'cout' is ambiguous cout << 0 << s; ^ tv.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("tv.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from tv.cpp:2: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema TV 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ă.