#4203
NumberOfPoints
În planul xOy
se găsesc n
puncte de coordonate numere naturale, nu neapărat aflate pe poziții distincte. Pentru fiecare punct din plan de coordonate (x, y)
trebuie să spuneți câte alte puncte au coordonatele (p, q)
cu proprietatea că 0 ≤ p < x
și 0 ≤ q ≤ y
(atenție, p
este strict mai mic decât x
, iar q
este mai mic sau egal cu y
).
Folclorul informatic
Problema | NumberOfPoints | Operații I/O |
numberofpoints.in /numberofpoints.out
|
---|---|---|---|
Limita timp | 0.3 secunde | Limita memorie |
Total: 128 MB
/
Stivă 64 MB
|
Id soluție | #43498376 | Utilizator | |
Fișier | numberofpoints.cpp | Dimensiune | 1.38 KB |
Data încărcării | 29 Aprilie 2023, 15:40 | Scor / rezultat | Eroare de compilare |
numberofpoints.cpp:8:24: error: 'int y1' redeclared as different kind of symbol int n, a, b, c, d, x1, y1, x2, y2; ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iostream:38, from numberofpoints.cpp:1: /usr/include/i386-linux-gnu/bits/mathcalls.h:241:1: error: previous declaration of 'double y1(double)' __MATHCALL (y1,, (_Mdouble_)); ^ numberofpoints.cpp: In function 'int main()': numberofpoints.cpp:14:34: error: cannot bind 'std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}' lvalue to 'std::basic_istream<char>&&' fin >> n >> a >> b >> c >> d >> x1 >> y1 >> x2 >> y2; ^ In file included from /usr/include/c++/4.8/iostream:40:0, from numberofpoints.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = double(double)throw ()]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ numberofpoints.cpp:17:25: error: no matching function for call to 'min(double (&)(double)throw (), int&)' int y_1 = min(y1, y2), y_2 = max(y1, y2); ^ numberofpoints.cpp:17:25: note: candidates are: In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from numberofpoints.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template argument deduction/substitution failed: numberofpoints.cpp:17:25: note: deduced conflicting types for parameter 'const _Tp' ('double(double)throw ()' and 'int') int y_1 = min(y1, y2), y_2 = max(y1, y2); ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from numberofpoints.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template argument deduction/substitution failed: numberofpoints.cpp:17:25: note: deduced conflicting types for parameter 'const _Tp' ('double(double)throw ()' and 'int') int y_1 = min(y1, y2), y_2 = max(y1, y2); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from numberofpoints.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template<class _Tp> _Tp std::min(std::initializer_list<_Tp>) min(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template argument deduction/substitution failed: numberofpoints.cpp:17:25: note: mismatched types 'std::initializer_list<_Tp>' and 'double (*)(double)throw ()' int y_1 = min(y1, y2), y_2 = max(y1, y2); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from numberofpoints.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare) min(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template argument deduction/substitution failed: numberofpoints.cpp:17:25: note: mismatched types 'std::initializer_list<_Tp>' and 'double (*)(double)throw ()' int y_1 = min(y1, y2), y_2 = max(y1, y2); ^ numberofpoints.cpp:21:41: error: invalid conversion from 'double (*)(double)throw ()' to 'int' [-fpermissive] int x_i_2 = x1, x_i_1 = x2, y_i_2 = y1, y_i_1 = y2; ^ numberofpoints.cpp:40:30: error: 'y' was not declared in this scope if (points[j] <= y[i] && points[j] >= y_1 && x[j] < x[i] && x[j] >= x_1) { ^ numberofpoints.cpp:40:58: error: 'x' was not declared in this scope if (points[j] <= y[i] && points[j] >= y_1 && x[j] < x[i] && x[j] >= x_1) { ^ numberofpoints.cpp:16:28: warning: unused variable 'x_2' [-Wunused-variable] int x_1 = min(x1, x2), x_2 = max(x1, x2); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema NumberOfPoints 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ă.