#1081
Numar3
Se dă un număr raţional strict pozitiv q
, sub formă de fracţie zecimală.
Să se determine două numere naturale a
şi b
astfel \( q= \frac{a}{b} \) încât iar modulul diferenţei dintre a
şi b
să fie minim.
OJI 2010, Clasa a IX-a
Problema | Numar3 | Operații I/O |
numar3.in /numar3.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 2 MB
/
Stivă 1 MB
|
Id soluție | #54565667 | Utilizator | |
Fișier | numar3.cpp | Dimensiune | 961 B |
Data încărcării | 02 Decembrie 2024, 17:30 | Scor / rezultat | Eroare de compilare |
numar3.cpp: In function 'int main()': numar3.cpp:22:10: error: no match for 'operator*=' (operand types are 'std::bitset<10000u>' and 'int') a*=10; ^ numar3.cpp:23:10: error: no match for 'operator+=' (operand types are 'std::bitset<10000u>' and 'int') a+=pi; ^ numar3.cpp:28:10: error: no match for 'operator*=' (operand types are 'std::bitset<10000u>' and 'int') b*=10; ^ numar3.cpp:29:10: error: no match for 'operator*=' (operand types are 'std::bitset<10000u>' and 'int') a*=10; ^ numar3.cpp:30:10: error: no match for 'operator+=' (operand types are 'std::bitset<10000u>' and 'int') a+=pf; ^ numar3.cpp:33:20: error: cannot convert 'std::bitset<10000u>' to 'long long int' in initialization long long aaux=a,baux=b; ^ numar3.cpp:33:27: error: cannot convert 'std::bitset<10000u>' to 'long long int' in initialization long long aaux=a,baux=b; ^ numar3.cpp:41:6: error: no match for 'operator/=' (operand types are 'std::bitset<10000u>' and 'long long int') a/=baux; ^ numar3.cpp:42:6: error: no match for 'operator/=' (operand types are 'std::bitset<10000u>' and 'long long int') b/=baux; ^ numar3.cpp:43:18: error: no matching function for call to 'to_string(std::bitset<10000u>&)' s=to_string(a); ^ numar3.cpp:43:18: note: candidates are: In file included from /usr/include/c++/4.8/string:52:0, 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/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from numar3.cpp:7: /usr/include/c++/4.8/bits/basic_string.h:2864:3: note: std::string std::to_string(int) to_string(int __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2864:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'int' /usr/include/c++/4.8/bits/basic_string.h:2869:3: note: std::string std::to_string(unsigned int) to_string(unsigned __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2869:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'unsigned int' /usr/include/c++/4.8/bits/basic_string.h:2875:3: note: std::string std::to_string(long int) to_string(long __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2875:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'long int' /usr/include/c++/4.8/bits/basic_string.h:2880:3: note: std::string std::to_string(long unsigned int) to_string(unsigned long __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2880:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'long unsigned int' /usr/include/c++/4.8/bits/basic_string.h:2886:3: note: std::string std::to_string(long long int) to_string(long long __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2886:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'long long int' /usr/include/c++/4.8/bits/basic_string.h:2892:3: note: std::string std::to_string(long long unsigned int) to_string(unsigned long long __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2892:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'long long unsigned int' /usr/include/c++/4.8/bits/basic_string.h:2898:3: note: std::string std::to_string(float) to_string(float __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2898:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'float' /usr/include/c++/4.8/bits/basic_string.h:2907:3: note: std::string std::to_string(double) to_string(double __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2907:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'double' /usr/include/c++/4.8/bits/basic_string.h:2916:3: note: std::string std::to_string(long double) to_string(long double __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2916:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'long double' numar3.cpp:47:18: error: no matching function for call to 'to_string(std::bitset<10000u>&)' s=to_string(b); ^ numar3.cpp:47:18: note: candidates are: In file included from /usr/include/c++/4.8/string:52:0, 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/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from numar3.cpp:7: /usr/include/c++/4.8/bits/basic_string.h:2864:3: note: std::string std::to_string(int) to_string(int __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2864:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'int' /usr/include/c++/4.8/bits/basic_string.h:2869:3: note: std::string std::to_string(unsigned int) to_string(unsigned __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2869:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'unsigned int' /usr/include/c++/4.8/bits/basic_string.h:2875:3: note: std::string std::to_string(long int) to_string(long __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2875:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'long int' /usr/include/c++/4.8/bits/basic_string.h:2880:3: note: std::string std::to_string(long unsigned int) to_string(unsigned long __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2880:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'long unsigned int' /usr/include/c++/4.8/bits/basic_string.h:2886:3: note: std::string std::to_string(long long int) to_string(long long __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2886:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'long long int' /usr/include/c++/4.8/bits/basic_string.h:2892:3: note: std::string std::to_string(long long unsigned int) to_string(unsigned long long __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2892:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'long long unsigned int' /usr/include/c++/4.8/bits/basic_string.h:2898:3: note: std::string std::to_string(float) to_string(float __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2898:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'float' /usr/include/c++/4.8/bits/basic_string.h:2907:3: note: std::string std::to_string(double) to_string(double __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2907:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'double' /usr/include/c++/4.8/bits/basic_string.h:2916:3: note: std::string std::to_string(long double) to_string(long double __val) ^ /usr/include/c++/4.8/bits/basic_string.h:2916:3: note: no known conversion for argument 1 from 'std::bitset<10000u>' to 'long double'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Numar3 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ă.