- 幂的末尾
求求写过的大佬发个题解
- 2023-10-15 14:53:18 @
求求啦
1 comments
-
DEV LV 7 @ 2023-10-17 21:08:49
#include<iostream> using namespace std; int main() { int a,b,k=1; cin>>a>>b; for(int i=1;i<=b;i++) { k*=a;//k*a的i次结果 k%=1000; //排除千位数往上的数字,k存储后三位 } if(k>=100) cout<<k<<endl;//结果为三位的情况 else if(k>=10) cout<<"0"<<k<<endl;//结果为两位的情况 else cout<<"00"<<k<<endl;//结果为一位的情况 return 0; }
- 1
Information
- ID
- 579
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 2
- Tags
- (None)
- # Submissions
- 150
- Accepted
- 91
- Uploaded By