QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#566051 | #7562. Except One | Crysfly | AC ✓ | 0ms | 3728kb | C++14 | 2.4kb | 2024-09-15 22:56:27 | 2024-09-15 22:56:29 |
Judging History
answer
// what is matter? never mind.
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define ull unsigned long long
//#define int __int128
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;return x;
}
int mod;
struct modint{
int x;
modint(int o=0){x=o;}
modint &operator = (int o){return x=o,*this;}
modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
modint &operator ^=(int b){
modint a=*this,c=1;
for(;b;b>>=1,a*=a)if(b&1)c*=a;
return x=c.x,*this;
}
modint &operator /=(modint o){return *this *=o^=mod-2;}
friend modint operator +(modint a,modint b){return a+=b;}
friend modint operator -(modint a,modint b){return a-=b;}
friend modint operator *(modint a,modint b){return a*=b;}
friend modint operator /(modint a,modint b){return a/=b;}
friend modint operator ^(modint a,int b){return a^=b;}
friend bool operator ==(modint a,int b){return a.x==b;}
friend bool operator !=(modint a,int b){return a.x!=b;}
bool operator ! () {return !x;}
modint operator - () {return x?mod-x:0;}
bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}
vector<modint> fac,ifac,iv;
inline void initC(int n)
{
if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
int m=iv.size(); ++n;
if(m>=n)return;
iv.resize(n),fac.resize(n),ifac.resize(n);
For(i,m,n-1){
iv[i]=iv[mod%i]*(mod-mod/i);
fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
}
}
inline modint C(int n,int m){
if(m<0||n<m)return 0;
return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 1000005
#define inf 0x3f3f3f3f
int p,k,t;
signed main()
{
mod=read(),k=read(),t=read();
modint res=qpow(mod-k,t);
cout<<res.x;
return 0;
}
/*
6
3
1 1 1
3
1 1 2
3
1 1 3
3
1 2 1
3
1 2 2
3
1 2 3
*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3728kb
input:
7 5 3
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
11 6 7
output:
3
result:
ok 1 number(s): "3"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
3 2 1
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3708kb
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: 0
Accepted
time: 0ms
memory: 3652kb
input:
659446013 641119314 378275666
output:
290624162
result:
ok 1 number(s): "290624162"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
227 163 124
output:
189
result:
ok 1 number(s): "189"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
197 187 19
output:
62
result:
ok 1 number(s): "62"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
5 3 3
output:
3
result:
ok 1 number(s): "3"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
7 6 4
output:
1
result:
ok 1 number(s): "1"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
7 1 1
output:
6
result:
ok 1 number(s): "6"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
782371 586755 418517
output:
298550
result:
ok 1 number(s): "298550"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
181081 178315 76002
output:
125177
result:
ok 1 number(s): "125177"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
715019 492103 446729
output:
221541
result:
ok 1 number(s): "221541"
Test #15:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
238985261 199832612 162675695
output:
65826267
result:
ok 1 number(s): "65826267"
Test #16:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
129716453 10994076 62963738
output:
5186275
result:
ok 1 number(s): "5186275"
Test #17:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
962360593 652577122 345596237
output:
814039152
result:
ok 1 number(s): "814039152"
Test #18:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
871606937 839183139 754188014
output:
466391387
result:
ok 1 number(s): "466391387"
Test #19:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
275568091 270750503 241146839
output:
252569968
result:
ok 1 number(s): "252569968"
Test #20:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
562028473 111749710 450258818
output:
63116256
result:
ok 1 number(s): "63116256"