이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <algorithm>
using namespace std;
using ll = long long;
const ll MMOD = 1000000007;
const ll MAXN = 31347599;
inline ll popo(ll a, ll p) {
ll r =1;
while(p) {
if(p&1) r= (r*a)%MMOD;
a = (a*a) % MMOD;
p >>= 1LL;
}
return r;
}
ll arr[MAXN] = {0,1,2,2,};
int sss[6] = {0,1,2,4,12,36};
int main()
{
ll n;
ll cnt = 5;
ll ans = 36;
scanf("%lld", &n);
if(n<=5) {
printf("%d\n", sss[n]);
return 0;
}
ll gsize = 4;
bool sw = true;
for(int i=3;sw;++i){
ll ttmp = 1;
ll st = gsize;
for(ll j=0;j<arr[i];++j) {
cnt += i;
if (cnt >= n) {
ans = (ans * popo(ttmp, i))%MMOD;
ans = (ans * popo(gsize, i - (cnt-n)))%MMOD;
printf("%lld\n", ans);
return 0;
}
arr[gsize] = i;
ttmp = (ttmp * gsize) % MMOD;
gsize++;
}
ans = (ans * popo(ttmp, i))%MMOD;
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
FG.cpp: In function 'int main()':
FG.cpp:35:12: warning: unused variable 'st' [-Wunused-variable]
ll st = gsize;
^
FG.cpp:26:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld", &n);
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |