/ SeriousOJ /

Record Detail

Compile Error

foo.cc: In function 'void sir()':
foo.cc:26:20: error: no matching function for call to 'ceil(long long int, int)'
   26 |         ll v = ceil((k/n), 2);
      |                ~~~~^~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:114,
                 from foo.cc:5:
/usr/include/c++/13/cmath:170:5: note: candidate: 'template<class _Tp> constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::ceil(_Tp)'
  170 |     ceil(_Tp __x)
      |     ^~~~
/usr/include/c++/13/cmath:170:5: note:   template argument deduction/substitution failed:
foo.cc:26:20: note:   candidate expects 1 argument, 2 provided
   26 |         ll v = ceil((k/n), 2);
      |                ~~~~^~~~~~~~~~
In file included from /usr/include/features.h:502,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/c++config.h:679,
                 from /usr/include/c++/13/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:33:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:159:1: note: candidate: 'double ceil(double)'
  159 | __MATHCALLX (ceil,, (_Mdouble_ __x), (__const__));
      | ^~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:159:1: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/13/cmath:162:3: note: candidate: 'constexpr long double std::ceil(long double)'
  162 |   ceil(long double __x)
      |   ^~~~
/usr/include/c++/13/cmath:162:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/13/cmath:158:3: note: candidate: 'constexpr float std::ceil(float)'
  158 |   ceil(float __x)
      |   ^~~~
/usr/include/c++/13/cmath:158:3: note:   candidate expects 1 argument, 2 provided

Code

/*
 *Copyright (c) Swadheen Islam Robi (SIR01)
 *Created on Fri Sep 06 2024 12:04:55 AM
 */
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pie 2*(acos(0.0))
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define pb push_back
#define endl "\n"
#define lcm(a,b) (a*b)/(__gcd<ll>(a,b))
#define mod 1000000007
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(),v.rend())
#define ALLAHU_AKBAR ios::sync_with_stdio(false); cin.tie(nullptr);

void sir()
{
    ll n,k; cin>>n>>k;
    
    if(k<=n) {cout<<0<<endl; return ;}
    
        ll v = ceil((k/n), 2);
        ll ans = (v * (k-(v*n)));
        cout<<ans<<endl;
    
}

int main() {
    ALLAHU_AKBAR

    ll t = 1;
    cin>>t;
    while(t--)
    {
        sir();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1092 Bitwise AND
Language
C++20 (G++ 13.2.0)
Submit At
2024-09-05 19:14:25
Judged At
2024-09-05 19:14:25
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes