#282
Se dă un şir cu n elemente, numere reale, numerotate de la 1 la n. Determinaţi numărul de ordine al primei şi al ultimei apariţii a valorii maxime din şir.
| Problema | PozMax | Operații I/O |
pozmax.in/pozmax.out
|
|---|---|---|---|
| Limita timp | 0.2 secunde | Limita memorie |
Total: 32 MB
/
Stivă 8 MB
|
| Id soluție | #62423554 | Utilizator | |
| Fișier | pozmax.cpp | Dimensiune | 424 B |
| Data încărcării | 21 Ianuarie 2026, 09:30 | Scor/rezultat | Eroare de compilare |
pozmax.cpp:4:13: error: variable 'std::ifstream cin' has initializer but incomplete type ifstream cin("pozmax.in"); ^ pozmax.cpp:5:14: error: variable 'std::ofstream cout' has initializer but incomplete type ofstream cout("pozmax.in"); ^ pozmax.cpp: In function 'int main()': pozmax.cpp:11:5: error: reference to 'cin' is ambiguous cin>>n; ^ pozmax.cpp:4:10: note: candidates are: <typeprefixerror>cin ifstream cin("pozmax.in"); ^ In file included from pozmax.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ pozmax.cpp:12:5: error: reference to 'cin' is ambiguous cin>>x; ^ pozmax.cpp:4:10: note: candidates are: <typeprefixerror>cin ifstream cin("pozmax.in"); ^ In file included from pozmax.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ pozmax.cpp:15:14: warning: left operand of comma operator has no effect [-Wunused-value] for(i=2;i<=n,i++) ^ pozmax.cpp:15:21: error: expected ';' before ')' token for(i=2;i<=n,i++) ^ pozmax.cpp:17:9: error: reference to 'cin' is ambiguous cin>>x; ^ pozmax.cpp:4:10: note: candidates are: <typeprefixerror>cin ifstream cin("pozmax.in"); ^ In file included from pozmax.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ pozmax.cpp:24:22: warning: suggest parentheses around assignment used as truth value [-Wparentheses] if(x=maxv) ^ pozmax.cpp:25:5: error: expected primary-expression before '}' token } ^ pozmax.cpp:25:5: error: expected ';' before '}' token pozmax.cpp:26:5: error: reference to 'cout' is ambiguous cout<<p<<" "<<u; ^ pozmax.cpp:5:10: note: candidates are: <typeprefixerror>cout ofstream cout("pozmax.in"); ^ In file included from pozmax.cpp:1:0: /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 PozMax 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ă.