Submission #22503

#TimeUsernameProblemLanguageResultExecution timeMemory
22503최숭실 (#40)Fully Generate (KRIII5_FG)C++11
7 / 7
309 ms313616 KiB
#include <cstdio> #include <queue> #include <set> #include <vector> #include <algorithm> #include <map> #define MOD 1000000007 long long pow(long long n, long long k) { if (k == 0) return 1; if (k == 1) return n%MOD; long long ret = pow(n, k / 2); ret = ret * ret % MOD; if (k & 1) ret = ret * n % MOD; return ret; } long long count(long long from, long long to) { } long long dy[40000000]; int main() { long long n; scanf("%lld", &n); long long ans = 1; long long nu = 1; long long i = 0; long long pv = 0; dy[1] = 1; dy[2] = dy[3] = 2; long long tot = 5; nu = 4; for (int i = 3; i < 40000000; i++) { long long tmp = 1; for (int j = nu; j < nu + dy[i] && j < 40000000; j++) { dy[j] = i; tot += i; tmp = j * tmp % MOD; } nu += dy[i]; if (nu >= 40000000) break; } ans = 1; nu = 0; tot = 1; for (i = 1; nu <= n; i++) { pv = dy[i]; if (nu + pv > n) break; tot = tot * i % MOD; if (dy[i] != dy[i + 1]) { ans = ans * pow(tot, pv) % MOD; tot = 1; } nu += pv; } n -= nu; ans = ans * pow(tot, dy[i - 1]) % MOD; ans = ans * pow(i, n) % MOD; printf("%lld\n", ans); }

Compilation message (stderr)

FG.cpp: In function 'long long int count(long long int, long long int)':
FG.cpp:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
FG.cpp: In function 'int main()':
FG.cpp:24:19: 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...