#1125
Se dau n
numere naturale, scrise sub forma \( a_{1}^{b_1} + a_{2}^{b_2} + \cdots + a_{m}^{b_m} \). Să se afle dacă numerele pot fi reprezentate pe 8 octeti, fără semn.
Problema | Overflow2 | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 1.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #55924058 | Utilizator | |
Fișier | overflow2.cpp | Dimensiune | 845 B |
Data încărcării | 30 Ianuarie 2025, 14:53 | Scor / rezultat | Eroare de compilare |
overflow2.cpp:9:8: warning: integer constant is so large that it is unsigned [enabled by default] lm=18446744073709551615; ^ overflow2.cpp:5:26: error: uninitialized const 'n' [-fpermissive] const unsigned long long n,i,m,j,x,y,lm,s,p,k,ok,ok1; ^ overflow2.cpp:5:28: error: uninitialized const 'i' [-fpermissive] const unsigned long long n,i,m,j,x,y,lm,s,p,k,ok,ok1; ^ overflow2.cpp:5:30: error: uninitialized const 'm' [-fpermissive] const unsigned long long n,i,m,j,x,y,lm,s,p,k,ok,ok1; ^ overflow2.cpp:5:32: error: uninitialized const 'j' [-fpermissive] const unsigned long long n,i,m,j,x,y,lm,s,p,k,ok,ok1; ^ overflow2.cpp:5:34: error: uninitialized const 'x' [-fpermissive] const unsigned long long n,i,m,j,x,y,lm,s,p,k,ok,ok1; ^ overflow2.cpp:5:36: error: uninitialized const 'y' [-fpermissive] const unsigned long long n,i,m,j,x,y,lm,s,p,k,ok,ok1; ^ overflow2.cpp:5:38: error: uninitialized const 'lm' [-fpermissive] const unsigned long long n,i,m,j,x,y,lm,s,p,k,ok,ok1; ^ overflow2.cpp:5:41: error: uninitialized const 's' [-fpermissive] const unsigned long long n,i,m,j,x,y,lm,s,p,k,ok,ok1; ^ overflow2.cpp:5:43: error: uninitialized const 'p' [-fpermissive] const unsigned long long n,i,m,j,x,y,lm,s,p,k,ok,ok1; ^ overflow2.cpp:5:45: error: uninitialized const 'k' [-fpermissive] const unsigned long long n,i,m,j,x,y,lm,s,p,k,ok,ok1; ^ overflow2.cpp:5:47: error: uninitialized const 'ok' [-fpermissive] const unsigned long long n,i,m,j,x,y,lm,s,p,k,ok,ok1; ^ overflow2.cpp:5:50: error: uninitialized const 'ok1' [-fpermissive] const unsigned long long n,i,m,j,x,y,lm,s,p,k,ok,ok1; ^ overflow2.cpp: In function 'int main()': overflow2.cpp:8:10: error: cannot bind 'std::istream {aka std::basic_istream<char>}' lvalue to 'std::basic_istream<char>&&' cin>>n; ^ In file included from /usr/include/c++/4.8/sstream:38:0, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from overflow2.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = const long long unsigned int]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ overflow2.cpp:9:7: error: assignment of read-only variable 'lm' lm=18446744073709551615; ^ overflow2.cpp:10:10: error: assignment of read-only variable 'i' for(i=1;i<=n;i++) ^ overflow2.cpp:10:19: error: increment of read-only variable 'i' for(i=1;i<=n;i++) ^ overflow2.cpp:12:14: error: cannot bind 'std::istream {aka std::basic_istream<char>}' lvalue to 'std::basic_istream<char>&&' cin>>m; ^ In file included from /usr/include/c++/4.8/sstream:38:0, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from overflow2.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = const long long unsigned int]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ overflow2.cpp:13:17: error: assignment of read-only variable 'ok' s=ok1=ok=0; ^ overflow2.cpp:13:14: error: assignment of read-only variable 'ok1' s=ok1=ok=0; ^ overflow2.cpp:13:10: error: assignment of read-only variable 's' s=ok1=ok=0; ^ overflow2.cpp:14:14: error: assignment of read-only variable 'j' for(j=1;j<=m && ok==0;j++) ^ overflow2.cpp:14:32: error: increment of read-only variable 'j' for(j=1;j<=m && ok==0;j++) ^ overflow2.cpp:16:18: error: cannot bind 'std::istream {aka std::basic_istream<char>}' lvalue to 'std::basic_istream<char>&&' cin>>x>>y; ^ In file included from /usr/include/c++/4.8/sstream:38:0, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from overflow2.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = const long long unsigned int]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ overflow2.cpp:17:14: error: assignment of read-only variable 'p' p=x; ^ overflow2.cpp:18:18: error: assignment of read-only variable 'k' for(k=2;k<=y && ok==0;k++) ^ overflow2.cpp:18:36: error: increment of read-only variable 'k' for(k=2;k<=y && ok==0;k++) ^ overflow2.cpp:22:22: error: assignment of read-only variable 'p' p=p*x; ^ overflow2.cpp:25:23: error: assignment of read-only variable 'ok' ok=1; ^ overflow2.cpp:28:18: error: assignment of read-only variable 'p' p=1; ^ overflow2.cpp:30:18: error: assignment of read-only variable 's' s=s+p; ^ overflow2.cpp:32:19: error: assignment of read-only variable 'ok' ok=1; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Overflow2 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ă.