2 条题解

  • 0
    @ 2025-10-8 17:02:05
    #include <bits/stdc++.h>
    using namespace std;
    typedef long long LL;
    const LL P=100003;
    LL qpow(LL a,LL b)
    {
        LL ans=1%P;a%=P;
        for(;b;b>>=1)
        {
            if(b&1)ans=ans*a%P;
            a=a*a%P;
        }
        return ans;
    }
    int main()
    {
        LL m,n;cin>>m>>n;
        LL sum=((qpow(m,n)-m*qpow(m-1,n-1))%P+P)%P;
        printf("%lld\n",sum);
        return 0;
    }
    
    • 0
      @ 2025-10-8 17:01:57
      #include<bits/stdc++.h>
      using namespace std;
      typedef long long LL;
      const LL P=100003;
      LL qpow(LL a,LL b)
      {
          LL ans=1%P;a%=P;
          for(;b;b>>=1)
          {
              if(b&1)ans=ans*a%P;
              a=a*a%P;
          }
          return ans;
      }
      int main()
      {
          LL m,n;cin>>m>>n;
          LL sum=((qpow(m,n)-m*qpow(m-1,n-1))%P+P)%P;
          printf("%lld\n",sum);
          return 0;
      }
      • 1

      信息

      ID
      2661
      时间
      1000ms
      内存
      256MiB
      难度
      3
      标签
      递交数
      84
      已通过
      43
      上传者