#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 | #52700693 | Utilizator | |
Fișier | finserare.cpp | Dimensiune | 463 B |
Data încărcării | 07 Octombrie 2024, 14:18 | Scor / rezultat | Eroare de compilare |
finserare.cpp: In function 'void inserare(int)': finserare.cpp:16:9: error: 'a' was not declared in this scope a = v[i]; b= v[j]; ^ finserare.cpp:16:19: error: 'b' was not declared in this scope a = v[i]; b= v[j]; ^ finserare.cpp:17:32: error: no matching function for call to 'abs(int&, int&)' v[i+1] = abs(v[i], v[j]); ^ finserare.cpp:17: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 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:17:32: note: candidate expects 1 argument, 2 provided v[i+1] = abs(v[i], v[j]); ^ 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
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ă.