QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#297439 | #7562. Except One | Saanteye# | WA | 1ms | 3608kb | C++14 | 635b | 2024-01-04 14:12:36 | 2024-01-04 14:12:36 |
Judging History
answer
#include <bits/stdc++.h>
//#include <vector>
using namespace std;
void solve() {
}
#define int long long
int p,k,t;
int mod;
int qpow(int a,int b)
{
int res=1;
while(b)
{
if(b&1) res=res*a%mod;
a=a*a%mod;
b>>=1;
}
return res;
}
signed main() {
ios::sync_with_stdio(false); cin.tie(0);
cin>>p>>k>>t;
mod=p;
int w=(1+p-1)*(p-1)%mod*qpow(2,mod-2)%mod;
w=((w-k)%mod+mod)%mod;
w=w*qpow(k,t-1)%mod;
cout<<w;
}
//1 2 3 4 5 6
//1 2 3 4 5
//1 2 3 4 6
//1 2 3 5 6
//1 2 4 5 6
//1 3 4 5 6
//2 3 4 5 6
//t=2
//p=7
//k(0-k(1+3+4+5+6))
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3448kb
input:
7 5 3
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3440kb
input:
11 6 7
output:
3
result:
ok 1 number(s): "3"
Test #3:
score: 0
Accepted
time: 1ms
memory: 3440kb
input:
3 2 1
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
596620183 516846890 38276329
output:
135352707
result:
ok 1 number(s): "135352707"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3388kb
input:
382744931 85302262 235496559
output:
14577469
result:
ok 1 number(s): "14577469"
Test #6:
score: -100
Wrong Answer
time: 0ms
memory: 3492kb
input:
659446013 641119314 378275666
output:
368821851
result:
wrong answer 1st numbers differ - expected: '290624162', found: '368821851'