#4006
Se dau trei numere naturale n a b, 1 ≤ a < b < n. Să se determine o modalitate de a-l scrie pe n ca sumă de termeni egali cu a sau b în care numărul de termeni egali cu a este maxim.
| Problema | PartitieAB | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #63554483 | Utilizator | |
| Fișier | partitieab.cpp | Dimensiune | 361 B |
| Data încărcării | 09 Martie 2026, 12:08 | Scor/rezultat | Eroare de compilare |
partitieab.cpp: In function 'int main()': partitieab.cpp:7:12: error: cannot bind 'std::istream {aka std::basic_istream<char>}' lvalue to 'std::basic_istream<char>&&' cin>>n>>a>>b; ^ In file included from /usr/include/c++/4.8/iostream:40:0, from partitieab.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 = int [1000002]]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ partitieab.cpp:8:12: error: invalid operands of types 'int' and 'int [1002]' to binary 'operator*' n=ka*a+kb*b; ^ partitieab.cpp:8:17: error: invalid operands of types 'int' and 'int [1002]' to binary 'operator*' n=ka*a+kb*b; ^ partitieab.cpp:9:22: error: invalid operands of types 'int [1000002]' and 'int [1002]' to binary 'operator/' for(kb=0;kb<=n/b;kb++) ^ partitieab.cpp:10:20: error: invalid operands of types 'int' and 'int [1002]' to binary 'operator*' if((n-kb*b)%a==0) ^ partitieab.cpp:12:20: error: invalid operands of types 'int' and 'int [1002]' to binary 'operator*' ka=(n-kb*b)/a; ^ partitieab.cpp:13:20: error: invalid operands of types 'int' and 'int [1002]' to binary 'operator*' ka=(n-ka*a)/a; ^ partitieab.cpp:14:20: error: invalid operands of types 'int' and 'int [1002]' to binary 'operator*' kb=(n-kb*b)/b; ^ partitieab.cpp:15:20: error: invalid operands of types 'int' and 'int [1002]' to binary 'operator*' kb=(n-ka*a)/b; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema PartitieAB 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ă.