Submission #22888

#TimeUsernameProblemLanguageResultExecution timeMemory
22888Name10Fully Generate (KRIII5_FG)C++11
2 / 7
9 ms5924 KiB
#include <iostream> #include <cstdio> using namespace std; int dat[1000005], n; long long ans = 4; int main() { cin >> n; if (n == 1) { cout << 1; } else if (n == 2) { cout << 2; } else if (n == 3) { cout << 4; } else { dat[1] = 1; dat[2] = 2; dat[3] = 2; int gen_num = 3, left_cnt = dat[3]; int i = 4; while (i <= n) { if (left_cnt > 0) { dat[i] = gen_num; ans = (ans * (dat[i] % 1000000007)) % 1000000007; left_cnt--; i++; } else { left_cnt = dat[++gen_num]; } } cout << ans; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...