1 条题解
-
0
逐个十进制数位计算模幂,正确处理后四位全为零的大指数。
#include <bits/stdc++.h> using namespace std; int power(int a,int n){int b=1;while(n){if(n&1)b=b*a%10000;a=a*a%10000;n>>=1;}return b;}int main(){int k;cin>>k;while(k--){string s;cin>>s;int result=1;for(char c:s)result=power(result,10)*power(2011,c-'0')%10000;cout<<result<<"\n";}}
- 1
信息
- ID
- 3909
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 4
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者