fork download
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. int t, c=0;
  8. cin>>t;
  9. while(c<t){
  10. long sum;
  11. int a,b;
  12. cin>>a;
  13. cin>>b;
  14. sum=pow((b,2)*pow((b+1),2)))/4 + 3* (b*(2*b+1)*(b+1)))/6 + 2*(b*(b+1)))/2;
  15. sum-=pow((a,2)*pow((a+1),2)))/4 + 3* (a*(2*a+1)*(a+1)))/6 + 2*(a*(a+1)))/2;
  16. cout<<sum%100<<"\n";
  17. sum=0;
  18. c++;
  19. }
  20. return 0;
  21. }
Compilation error #stdin compilation error #stdout 0s 15240KB
stdin
3
1 10
30 30
1 1000
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:14:29: error: no matching function for call to ‘pow(__gnu_cxx::__promote_2<int, int, double, double>::__type)’
   sum=pow((b,2)*pow((b+1),2)))/4 + 3* (b*(2*b+1)*(b+1)))/6 + 2*(b*(b+1)))/2;
                             ^
In file included from /usr/include/features.h:364:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/c++config.h:507,
                 from /usr/include/c++/6/iostream:38,
                 from prog.cpp:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:153:1: note: candidate: double pow(double, double)
 __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
 ^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:153:1: note:   candidate expects 2 arguments, 1 provided
In file included from /usr/include/c++/6/math.h:36:0,
                 from prog.cpp:2:
/usr/include/c++/6/cmath:438:5: note: candidate: template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)
     pow(_Tp __x, _Up __y)
     ^~~
/usr/include/c++/6/cmath:438:5: note:   template argument deduction/substitution failed:
prog.cpp:14:29: note:   candidate expects 2 arguments, 1 provided
   sum=pow((b,2)*pow((b+1),2)))/4 + 3* (b*(2*b+1)*(b+1)))/6 + 2*(b*(b+1)))/2;
                             ^
In file included from /usr/include/c++/6/math.h:36:0,
                 from prog.cpp:2:
/usr/include/c++/6/cmath:415:3: note: candidate: constexpr long double std::pow(long double, long double)
   pow(long double __x, long double __y)
   ^~~
/usr/include/c++/6/cmath:415:3: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/6/cmath:411:3: note: candidate: constexpr float std::pow(float, float)
   pow(float __x, float __y)
   ^~~
/usr/include/c++/6/cmath:411:3: note:   candidate expects 2 arguments, 1 provided
prog.cpp:15:30: error: no matching function for call to ‘pow(__gnu_cxx::__promote_2<int, int, double, double>::__type)’
   sum-=pow((a,2)*pow((a+1),2)))/4 + 3* (a*(2*a+1)*(a+1)))/6 + 2*(a*(a+1)))/2;
                              ^
In file included from /usr/include/features.h:364:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/c++config.h:507,
                 from /usr/include/c++/6/iostream:38,
                 from prog.cpp:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:153:1: note: candidate: double pow(double, double)
 __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
 ^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:153:1: note:   candidate expects 2 arguments, 1 provided
In file included from /usr/include/c++/6/math.h:36:0,
                 from prog.cpp:2:
/usr/include/c++/6/cmath:438:5: note: candidate: template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)
     pow(_Tp __x, _Up __y)
     ^~~
/usr/include/c++/6/cmath:438:5: note:   template argument deduction/substitution failed:
prog.cpp:15:30: note:   candidate expects 2 arguments, 1 provided
   sum-=pow((a,2)*pow((a+1),2)))/4 + 3* (a*(2*a+1)*(a+1)))/6 + 2*(a*(a+1)))/2;
                              ^
In file included from /usr/include/c++/6/math.h:36:0,
                 from prog.cpp:2:
/usr/include/c++/6/cmath:415:3: note: candidate: constexpr long double std::pow(long double, long double)
   pow(long double __x, long double __y)
   ^~~
/usr/include/c++/6/cmath:415:3: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/6/cmath:411:3: note: candidate: constexpr float std::pow(float, float)
   pow(float __x, float __y)
   ^~~
/usr/include/c++/6/cmath:411:3: note:   candidate expects 2 arguments, 1 provided
stdout
Standard output is empty