#2995
Finserare
C++
Scrieți funcția inserare
care primește ca parametru un număr natural n
și furnizează prin intermediul aceluiași parametru numărul obținut din n
prin inserarea, între oricare două cifre alăturate ale sale, a valorii absolute a diferenței acestora.
Simulare bacalaureat 2019
Problema | Finserare | Operații I/O |
finserare.in /finserare.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54861298 | Utilizator | |
Fișier | finserare.cpp | Dimensiune | 254 B |
Data încărcării | 10 Decembrie 2024, 17:04 | Scor / rezultat | Eroare de compilare |
finserare.cpp: In function 'int inserare(int&)': finserare.cpp:15:22: error: no matching function for call to 'abs(int&, int&)' b[p]=abs(a[j],a[j+1]); ^ finserare.cpp:15:22: 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 finserare.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 finserare.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: finserare.cpp:15:22: note: candidate expects 1 argument, 2 provided b[p]=abs(a[j],a[j+1]); ^ In file included from finserare.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 finserare.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 finserare.cpp:6:33: warning: unused variable 'm' [-Wunused-variable] {int a[20],b[10],uc,j,i=0,l,p=0,m=0; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Finserare face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. 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ă.