1 solutions

  • 0
    @ 2024-4-13 13:27:06

    #include #include #include #include #include<math.h> using namespace std;

    long long ksm(long long n,long long m,long long k) { if(m==0) return 1;

    long long z=ksm(n,m>>1,k);
    
    z=1ll*z*z%k;//不可与if的判断互换顺序,防止多乘一次n
    
    if(m%2==1)
    {
        z=1ll*z*n%k;
    }
    
    return z;
    

    }

    int main(void) { long long n,ans_j,ans_o,ans_all;

    scanf("%lld",&n);

    错的

    • 1

    Information

    ID
    2451
    Time
    1000ms
    Memory
    125MiB
    Difficulty
    3
    Tags
    # Submissions
    1
    Accepted
    1
    Uploaded By