# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
73251 | maus1208 | Asceticism (JOI18_asceticism) | C++14 | 3 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#import<bits/stdc++.h>
using namespace std;
#define sysp system("pause")
#define mod 1000000007
#define rmod 1000000005
typedef long long ll;
ll n,k,ans;
vector<ll> f,rf;
ll mypow(ll x,ll n){
ll ret=1;
while(n>0){
if((n&1)==1){
ret*=x%mod;
}
x*=x%mod;
n>>=1;
}
return ret%mod;
}
void init(){
f[0]=1;
rf[0]=1;
for(ll i=1;i<=100010;i++){
f[i]*=i*f[i-1]%mod;
rf[i]=mypow(f[i],rmod);
}
}
int main(){
cin>>n>>k;
ll tmp=-1;
init();
for(ll i=0;i<=k;i++){
tmp*=-1;
ans+=f[n+1]*rf[i]*rf[n+1-i]*tmp*mypow((k-i+1),n)%mod;
}
cout<<ans<<endl;
sysp;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |