QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#369153 | #7562. Except One | zhouyidie | WA | 1ms | 3708kb | C++20 | 1.1kb | 2024-03-27 21:07:45 | 2024-03-27 21:07:46 |
Judging History
answer
#include<bits/stdc++.h>
typedef long long LL ;
const int N = 1e6 + 10 , INF = 1e9 + 7 ;
using namespace std ;
int p ;
LL n , m , k , tt ;
int a[ N ] , af[ N ] , b[ N ] , bf[ N ] ;
LL qmi( LL di , LL mi ){
LL res = 1 ;
while( mi ){
if( mi & 1 ){
res *= di ; res %= p ;
}
di *= di ; di %= p ;
mi /= 2 ;
}
di *= di ; di %= p ;
mi /= 2 ;
return res % p ;
}
void AC(){
// cin >> n ;
// for( int i = 1 ; i <= n ; i ++ ){
// cin >> a[ i ] ;
// if( i >= 2 ){
// af[ i - 1 ] = a[ i ] - a[ i - 1 ] ;
// }
// }
//
// for( int i = 1 ; i <= n ; i ++ ){
// cin >> b[ i ] ;
// if( i >= 2 ){
// bf[ i - 1 ] = b[ i ] - b[ i - 1 ] ;
// }
//
// }
cin >> p >> k >> tt ;
int ans = p - qmi( k , tt ) ;
cout << ans << endl;
return ;
}
int main(){
ios::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0) ;
int t = 1 ;
//cin >> t ;
//cout << ( 1296 * 216 ) % 11 << endl ;
while( t-- ){
AC() ;
}
return 0 ;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3548kb
input:
7 5 3
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
11 6 7
output:
3
result:
ok 1 number(s): "3"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
3 2 1
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
596620183 516846890 38276329
output:
135352707
result:
ok 1 number(s): "135352707"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
382744931 85302262 235496559
output:
14577469
result:
ok 1 number(s): "14577469"
Test #6:
score: -100
Wrong Answer
time: 1ms
memory: 3672kb
input:
659446013 641119314 378275666
output:
368821851
result:
wrong answer 1st numbers differ - expected: '290624162', found: '368821851'