This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |