# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
420770 | qwerasdfzxcl | Asceticism (JOI18_asceticism) | C++14 | 58 ms | 292 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int MOD = 1e9+7;
ll pw(ll a, ll e){
if (!e) return 1;
ll ret = pw(a, e/2);
if (e&1) return ret*ret%MOD*a%MOD;
return ret*ret%MOD;
}
int main(){
int n, k;
scanf("%d %d", &n, &k);
ll ans = 0, tmp = 1;
for (int i=k;i;i--){
ans = (ans+pw(i, n)*tmp)%MOD;
tmp = (-tmp*(n+1-k+i)%MOD)*pw(k-i+1, MOD-2)%MOD;
if (tmp<0) tmp += MOD;
}
printf("%lld\n", ans);
return 0;
}
컴파일 시 표준 에러 (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... |