ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#202791 | #3548. pow | Allen123456hello | 100 | 0ms | 1196kb | C++11 | 372b | 2024-02-17 09:33:33 | 2024-02-17 13:14:28 |
answer
#include <bits/stdc++.h>
using namespace std;
__int128 pow(__int128 a,__int128 b,const __int128 c){
a%=c;__int128 ans=1;
while (b){
if (b&1){ans*=a;ans%=c;}
a*=a;a%=c;
b>>=1;
}
return ans;
};
long long a,b,c;
int main(){
scanf("%lld%lld%lld",&a,&b,&c);
printf("%lld",(long long)(pow(a,b,c)));
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1192kb
input:
68331 68573 998244352
output:
293741275
result:
ok single line: '293741275'
Test #2:
score: 10
Accepted
time: 0ms
memory: 1196kb
input:
492633589920418497 614936933939541807 998244352
output:
396003649
result:
ok single line: '396003649'
Test #3:
score: 10
Accepted
time: 0ms
memory: 1196kb
input:
714847614091941559 437720336074058655 998244352
output:
55508487
result:
ok single line: '55508487'
Test #4:
score: 10
Accepted
time: 0ms
memory: 1196kb
input:
795761552677473363 996235504316926809 998244352
output:
83343219
result:
ok single line: '83343219'
Test #5:
score: 10
Accepted
time: 0ms
memory: 1192kb
input:
922775944742094083 738364982231145619 722765401220272391
output:
614037901234556929
result:
ok single line: '614037901234556929'
Test #6:
score: 10
Accepted
time: 0ms
memory: 1196kb
input:
855579180739012013 573801220305525717 419267732261406547
output:
71485526853465542
result:
ok single line: '71485526853465542'
Test #7:
score: 10
Accepted
time: 0ms
memory: 1196kb
input:
795120597224342033 671653932363513029 610090323098396995
output:
164343717906310328
result:
ok single line: '164343717906310328'
Test #8:
score: 10
Accepted
time: 0ms
memory: 1192kb
input:
978999426791571589 588625801826887893 799576868810095781
output:
442564150938766117
result:
ok single line: '442564150938766117'
Test #9:
score: 10
Accepted
time: 0ms
memory: 1192kb
input:
454990929271076423 687063077602980771 371223928370355377
output:
110567687898242288
result:
ok single line: '110567687898242288'
Test #10:
score: 10
Accepted
time: 0ms
memory: 1192kb
input:
502048631939309301 939481413902908773 595069909588590251
output:
200773774138946921
result:
ok single line: '200773774138946921'