| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 77386 | tmwilliamlin168 | Asceticism (JOI18_asceticism) | C++14 | 38 ms | 1864 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mxN=1e5, M=1e9+7;
int n, k;
ll fi[mxN+1], ans;
ll exp(ll b, int p) {
ll r=1;
while(p) {
if(p&1)
r=b*r%M;
b=b*b%M;
p/=2;
}
return r;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> k;
fi[0]=1;
for(int i=1; i<=n; ++i)
fi[i]=exp(i, M-2)*fi[i-1]%M;
for(int j=0; j<=1; ++j)
for(int i=0; i<k-j; ++i)
ans+=(i&1^j?M-1:1)*exp(k-j-i, n)%M*fi[i]%M*fi[n-i]%M;
for(int i=2; i<=n; ++i)
ans=i*ans%M;
cout << ans;
}
컴파일 시 표준 에러 (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... | ||||
