Submission #22547

#TimeUsernameProblemLanguageResultExecution timeMemory
22547추억의 skyseasoft (#40)Fully Generate (KRIII5_FG)C++98
2 / 7
500 ms251116 KiB
#include<stdio.h> #define M ((ll)1e9 + 7) typedef long long ll; ll n,a[32000000]; ll f(ll a, ll b) { if(!b) return 1; if(b & 1) return f(a,b-1) * a % M; ll k = f(a, b>>1); return k*k%M; } int main() { scanf("%lld",&n); if(n <= 4) { ll r[5] = {0,1,2,4,12}; printf("%lld", r[n]); } else { a[1] = 1, a[2] = 2, a[3] = 2; ll res = 4, i=3, s=3; for(ll j=4;s+a[i]<n;i++) { for(ll k=0;j<32000000 && k<a[i];k++) a[j++] = i; res = (res * f(i,a[i])) % M; s += a[i]; } res = (res * f(i, n-s)) % M; printf("%lld", res); } return 0; }

Compilation message (stderr)

FG.cpp: In function 'int main()':
FG.cpp:12:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&n);
                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...