# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
22628 | 2017-04-30T06:00:22 Z | 현우야 이거 플로우야(#903, waylight3, pinebananais, ae04071) | Fully Generate (KRIII5_FG) | C++11 | 0 ms | 1308 KB |
#include <cstdio> #include <map> using namespace std; map<long long, long long> dp; int maxi = 2; long long gol(long long n) { long long sum = dp[1]; long long i; for (i = 2; i <= n; i++) { dp[i] = 1 + dp[i - dp[dp[i - 1]]]; sum += dp[i]; if (sum >= n) break; } return i; } long long gal(long long n) { n++; if (n % 2) return (2 * n * n - 2) / 8; return n * n / 4; } long long pow(long long a, long long n) { if (n == 0) return 1; if (n == 1) return a; if (n % 2) return a * pow(a, n - 1) % 1000000007; long long r = pow(a, n / 2); return r * r % 1000000007; } int main() { dp[1] = 1; long long n; scanf("%lld", &n); if (n == 1) { printf("1\n"); return 0; } long long ans = 1; long long g = gol(n); for (int i = 2; i < g; i++) ans = (ans * pow(i, i / 2 + 1)) % 1000000007; for (int i = 0; i <= n - gal(g); i++) ans = (ans * g) % 1000000007; printf("%lld\n", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1176 KB | Output is correct |
2 | Correct | 0 ms | 1176 KB | Output is correct |
3 | Correct | 0 ms | 1176 KB | Output is correct |
4 | Correct | 0 ms | 1176 KB | Output is correct |
5 | Correct | 0 ms | 1176 KB | Output is correct |
6 | Correct | 0 ms | 1176 KB | Output is correct |
7 | Correct | 0 ms | 1176 KB | Output is correct |
8 | Correct | 0 ms | 1176 KB | Output is correct |
9 | Correct | 0 ms | 1176 KB | Output is correct |
10 | Correct | 0 ms | 1176 KB | Output is correct |
11 | Incorrect | 0 ms | 1308 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1176 KB | Output is correct |
2 | Correct | 0 ms | 1176 KB | Output is correct |
3 | Correct | 0 ms | 1176 KB | Output is correct |
4 | Correct | 0 ms | 1176 KB | Output is correct |
5 | Correct | 0 ms | 1176 KB | Output is correct |
6 | Correct | 0 ms | 1176 KB | Output is correct |
7 | Correct | 0 ms | 1176 KB | Output is correct |
8 | Correct | 0 ms | 1176 KB | Output is correct |
9 | Correct | 0 ms | 1176 KB | Output is correct |
10 | Correct | 0 ms | 1176 KB | Output is correct |
11 | Incorrect | 0 ms | 1308 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |