#1
sum
Să se scrie un program care citeşte din fişier două numere întregi şi determină suma lor.
Problema | sum | Operații I/O |
sum.in /sum.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53772212 | Utilizator | |
Fișier | sum.cpp | Dimensiune | 1.23 KB |
Data încărcării | 11 Noiembrie 2024, 13:18 | Scor / rezultat | Eroare de compilare |
sum.cpp: In function 'long double distX(punct, punct, punct)': sum.cpp:36:44: error: call of overloaded 'abs(long double)' is ambiguous double long dist = 1.0*abs(xp - 1.0*p.x); ^ sum.cpp:36:44: 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 sum.cpp:1: /usr/include/stdlib.h:775:12: note: int abs(int) extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; ^ 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 sum.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:166:3: note: long int std::abs(long int) abs(long __i) { return __builtin_labs(__i); } ^ sum.cpp: In function 'long double distY(punct, punct, punct)': sum.cpp:51:44: error: call of overloaded 'abs(long double)' is ambiguous double long dist = 1.0*abs(yp - 1.0*p.y); ^ sum.cpp:51:44: 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 sum.cpp:1: /usr/include/stdlib.h:775:12: note: int abs(int) extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; ^ 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 sum.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:166:3: note: long int std::abs(long int) abs(long __i) { return __builtin_labs(__i); } ^ sum.cpp: In function 'int main()': sum.cpp:65:53: warning: narrowing conversion of 'x1' from 'int' to 'double' inside { } [-Wnarrowing] trg.push_back({{x1, y1}, {x2, y2}, {x3, y3}}); ^ sum.cpp:65:53: warning: narrowing conversion of 'y1' from 'int' to 'double' inside { } [-Wnarrowing] sum.cpp:65:53: warning: narrowing conversion of 'x2' from 'int' to 'double' inside { } [-Wnarrowing] sum.cpp:65:53: warning: narrowing conversion of 'y2' from 'int' to 'double' inside { } [-Wnarrowing] sum.cpp:65:53: warning: narrowing conversion of 'x3' from 'int' to 'double' inside { } [-Wnarrowing] sum.cpp:65:53: warning: narrowing conversion of 'y3' from 'int' to 'double' inside { } [-Wnarrowing]
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sum 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ă.