#3978
sabc
Dacă x
și y
sunt două numere naturale cu x ≤ y
, atunci notăm cu s(x,y)
suma numerelor naturale cuprinse între x
și y
. De exemplu, s(3,6) = 3+4+5+6 = 18
, iar s(7,7) = 7
. Se dau numerele naturale a
, b
și c
, unde a ≤ b ≤ c
. Calculați s(a,b)
, s(b,c)
și s(a,c)
.
Problema | sabc | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #48041522 | Utilizator | |
Fișier | sabc.cpp | Dimensiune | 166 B |
Data încărcării | 14 Ianuarie 2024, 00:09 | Scor / rezultat | Eroare de compilare |
sabc.cpp: In function 'int main()': sabc.cpp:5:20: warning: left shift count >= width of type [enabled by default] std::cout<<s=a+b<<' '; ^ sabc.cpp:5:16: warning: suggest parentheses around '+' inside '<<' [-Wparentheses] std::cout<<s=a+b<<' '; ^ sabc.cpp:5:14: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int') std::cout<<s=a+b<<' '; ^ sabc.cpp:5:14: note: candidate is: In file included from /usr/include/c++/4.8/iostream:39:0, from sabc.cpp:1: /usr/include/c++/4.8/ostream:58:11: note: std::basic_ostream<char>& std::basic_ostream<char>::operator=(const std::basic_ostream<char>&) <deleted> class basic_ostream : virtual public basic_ios<_CharT, _Traits> ^ /usr/include/c++/4.8/ostream:58:11: note: no known conversion for argument 1 from 'int' to 'const std::basic_ostream<char>&' sabc.cpp:6:24: warning: left shift count >= width of type [enabled by default] std::cout<<s=b+c<<' '; ^ sabc.cpp:6:20: warning: suggest parentheses around '+' inside '<<' [-Wparentheses] std::cout<<s=b+c<<' '; ^ sabc.cpp:6:18: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int') std::cout<<s=b+c<<' '; ^ sabc.cpp:6:18: note: candidate is: In file included from /usr/include/c++/4.8/iostream:39:0, from sabc.cpp:1: /usr/include/c++/4.8/ostream:58:11: note: std::basic_ostream<char>& std::basic_ostream<char>::operator=(const std::basic_ostream<char>&) <deleted> class basic_ostream : virtual public basic_ios<_CharT, _Traits> ^ /usr/include/c++/4.8/ostream:58:11: note: no known conversion for argument 1 from 'int' to 'const std::basic_ostream<char>&' sabc.cpp:7:28: warning: left shift count >= width of type [enabled by default] std::cout<<s=a+c<<' '; ^ sabc.cpp:7:24: warning: suggest parentheses around '+' inside '<<' [-Wparentheses] std::cout<<s=a+c<<' '; ^ sabc.cpp:7:22: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int') std::cout<<s=a+c<<' '; ^ sabc.cpp:7:22: note: candidate is: In file included from /usr/include/c++/4.8/iostream:39:0, from sabc.cpp:1: /usr/include/c++/4.8/ostream:58:11: note: std::basic_ostream<char>& std::basic_ostream<char>::operator=(const std::basic_ostream<char>&) <deleted> class basic_ostream : virtual public basic_ios<_CharT, _Traits> ^ /usr/include/c++/4.8/ostream:58:11: note: no known conversion for argument 1 from 'int' to 'const std::basic_ostream<char>&'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sabc 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ă.