QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#629270#5. 在线 O(1) 逆元7_divided_by_3Compile Error//C++20314b2024-10-11 10:09:592024-11-05 22:05:10

Judging History

你现在查看的是最新测评结果

  • [2024-11-05 22:05:10]
  • 管理员手动重测本题所有提交记录
  • [2024-10-11 10:09:59]
  • 评测
  • [2024-10-11 10:09:59]
  • 提交

answer

int modp;
void init(int p)
{
    modp=p;   
}

constexpr power(long long a,long long b,long long p)
{
    long long res=1;
    a%=p;
    while(b)
    {
        if(b&1)res=(res*a)%p;
        a=(a*a)%p;
        b>>=1;
    }
    return res;
}

int inv(int x)
{
    return power(x,modp-2,modp);
}

Details

implementer.cpp: In function ‘int main()’:
implementer.cpp:22:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
answer.code:7:11: error: ISO C++ forbids declaration of ‘power’ with no type [-fpermissive]
    7 | constexpr power(long long a,long long b,long long p)
      |           ^~~~~