#1322
PartitiiNr
Se dă un număr natural n
. Determinaţi, în ordine lexicografică, toate modalităţile de a-l scrie pe n
ca sumă de numere naturale ordonate crescător astfel încât diferența dintre doi termeni consecutivi ai sumei să fie cel puțin 2
.
Problema | PartitiiNr | Operații I/O |
partitiinr.in /partitiinr.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #52846720 | Utilizator | |
Fișier | partitiinr.cpp | Dimensiune | 713 B |
Data încărcării | 10 Octombrie 2024, 18:26 | Scor / rezultat | Eroare de compilare |
partitiinr.cpp: In function 'void valid()': partitiinr.cpp:15:32: error: no matching function for call to 'abs(int&, int&)' if(k>1 && abs(st[k-1],st[k])!=2) return 0; ^ partitiinr.cpp:15:32: note: candidates are: In file included from /usr/include/c++/4.8/cstdlib:72:0, from /usr/include/c++/4.8/ext/string_conversions.h:41, from /usr/include/c++/4.8/bits/basic_string.h:2815, from /usr/include/c++/4.8/string:52, 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 partitiinr.cpp:1: /usr/include/stdlib.h:775:12: note: int abs(int) extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; ^ /usr/include/stdlib.h:775:12: note: candidate expects 1 argument, 2 provided In file included from partitiinr.cpp:2:0: /usr/include/c++/4.8/cmath:99:5: note: template<class _Tp> constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::abs(_Tp) abs(_Tp __x) ^ /usr/include/c++/4.8/cmath:99:5: note: template argument deduction/substitution failed: partitiinr.cpp:15:32: note: candidate expects 1 argument, 2 provided if(k>1 && abs(st[k-1],st[k])!=2) return 0; ^ In file included from partitiinr.cpp:2:0: /usr/include/c++/4.8/cmath:91:3: note: constexpr long double std::abs(long double) abs(long double __x) ^ /usr/include/c++/4.8/cmath:91:3: note: candidate expects 1 argument, 2 provided /usr/include/c++/4.8/cmath:87:3: note: constexpr float std::abs(float) abs(float __x) ^ /usr/include/c++/4.8/cmath:87:3: note: candidate expects 1 argument, 2 provided /usr/include/c++/4.8/cmath:81:3: note: constexpr double std::abs(double) abs(double __x) ^ /usr/include/c++/4.8/cmath:81:3: note: candidate expects 1 argument, 2 provided In file included from /usr/include/c++/4.8/ext/string_conversions.h:41:0, from /usr/include/c++/4.8/bits/basic_string.h:2815, from /usr/include/c++/4.8/string:52, 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 partitiinr.cpp:1: /usr/include/c++/4.8/cstdlib:174:3: note: long long int std::abs(long long int) abs(long long __x) { return __builtin_llabs (__x); } ^ /usr/include/c++/4.8/cstdlib:174:3: note: candidate expects 1 argument, 2 provided /usr/include/c++/4.8/cstdlib:166:3: note: long int std::abs(long int) abs(long __i) { return __builtin_labs(__i); } ^ /usr/include/c++/4.8/cstdlib:166:3: note: candidate expects 1 argument, 2 provided partitiinr.cpp:15:45: error: return-statement with a value, in function returning 'void' [-fpermissive] if(k>1 && abs(st[k-1],st[k])!=2) return 0; ^ partitiinr.cpp:16:12: error: return-statement with a value, in function returning 'void' [-fpermissive] return 1; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema PartitiiNr 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ă.