#1291
CifreGen4
Se dau două numere n m
. Să se genereze toate numerele cu exact n
cifre mai mici decât m
cu proprietatea că diferența în valoare absolută dintre oricare două cifre consecutive este cel puțin 2
.
Problema | CifreGen4 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54657448 | Utilizator | |
Fișier | cifregen4.cpp | Dimensiune | 713 B |
Data încărcării | 04 Decembrie 2024, 19:08 | Scor / rezultat | Eroare de compilare |
cifregen4.cpp: In function 'int valid(int)': cifregen4.cpp:14:31: error: no matching function for call to 'abs(int&, int&)' if(abs(sol[k],sol[k-1])<2) ^ cifregen4.cpp:14:31: 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/ostream:38, from /usr/include/c++/4.8/iostream:39, from cifregen4.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 cifregen4.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: cifregen4.cpp:14:31: note: candidate expects 1 argument, 2 provided if(abs(sol[k],sol[k-1])<2) ^ In file included from cifregen4.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/ostream:38, from /usr/include/c++/4.8/iostream:39, from cifregen4.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
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema CifreGen4 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ă.