#1858
RestMare
Pentru un număr natural m
numim rest mare
cel mai mare rest pe care îl obţinem împărţind numărul m
la toate numerele naturale de la 1
la m
. Fiind dat un număr natural n
, se determină pentru fiecare număr de la 1
la n
numărul rest mare
, iar aceste resturi mari se însumează. Se cere aflarea acestei sume.
Problema | RestMare | Operații I/O |
restmare.in /restmare.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #55228792 | Utilizator | |
Fișier | restmare.cpp | Dimensiune | 220 B |
Data încărcării | 07 Ianuarie 2025, 17:21 | Scor / rezultat | Eroare de compilare |
restmare.cpp: In function 'int main()': restmare.cpp:10:6: error: no match for 'operator=' (operand types are 'std::ofstream {aka std::basic_ofstream<char>}' and 'long long int') b=n/2; ^ restmare.cpp:10:6: note: candidate is: In file included from restmare.cpp:1:0: /usr/include/c++/4.8/fstream:599:11: note: std::basic_ofstream<char>& std::basic_ofstream<char>::operator=(const std::basic_ofstream<char>&) <deleted> class basic_ofstream : public basic_ostream<_CharT,_Traits> ^ /usr/include/c++/4.8/fstream:599:11: note: no known conversion for argument 1 from 'long long int' to 'const std::basic_ofstream<char>&' restmare.cpp:11:19: error: no match for 'operator*' (operand types are 'std::ofstream {aka std::basic_ofstream<char>}' and 'std::ofstream {aka std::basic_ofstream<char>}') if(n%2==1)a<<b*b; ^ restmare.cpp:12:17: error: no match for 'operator-' (operand types are 'std::ofstream {aka std::basic_ofstream<char>}' and 'int') else a<<b*(b-1); ^ restmare.cpp:12:17: note: candidates are: In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from restmare.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:327:5: note: template<class _Iterator> typename std::reverse_iterator<_Iterator>::difference_type std::operator-(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&) operator-(const reverse_iterator<_Iterator>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:327:5: note: template argument deduction/substitution failed: restmare.cpp:12:18: note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'const std::reverse_iterator<_Iterator>' else a<<b*(b-1); ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from restmare.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:379:5: note: template<class _IteratorL, class _IteratorR> decltype ((__y.base() - __x.base())) std::operator-(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&) operator-(const reverse_iterator<_IteratorL>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:379:5: note: template argument deduction/substitution failed: restmare.cpp:12:18: note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'const std::reverse_iterator<_Iterator>' else a<<b*(b-1); ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from restmare.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1104:5: note: template<class _IteratorL, class _IteratorR> decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_Iterator>&, const std::move_iterator<_IteratorR>&) operator-(const move_iterator<_IteratorL>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:1104:5: note: template argument deduction/substitution failed: restmare.cpp:12:18: note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'const std::move_iterator<_Iterator>' else a<<b*(b-1); ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from restmare.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1111:5: note: template<class _Iterator> decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_Iterator>&, const std::move_iterator<_Iterator>&) operator-(const move_iterator<_Iterator>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:1111:5: note: template argument deduction/substitution failed: restmare.cpp:12:18: note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'const std::move_iterator<_Iterator>' else a<<b*(b-1); ^ restmare.cpp:8:17: warning: unused variable 'k' [-Wunused-variable] long long n,k; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema RestMare 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ă.