# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
22445 | 2017-04-30T04:44:28 Z | 예제는 나오는데 왜 틀리죠??(#895, baactree) | Fully Generate (KRIII5_FG) | C++14 | 466 ms | 395316 KB |
// ===================================================================================== // // Filename: fg.cpp // Created: 2017년 04월 30일 12시 39분 09초 // Compiler: g++ -O2 -std=c++14 // Author: baactree , [email protected] // Company: Chonnam National University // // ===================================================================================== #include <bits/stdc++.h> using namespace std; const int mod=1000000007; typedef long long ll; ll _pow(ll a, ll b){ if(b==0) return 1; ll temp=_pow(a, b/2); temp=(temp*temp)%mod; if(b&1) return (temp*a)%mod; return temp; } int main(){ int idx=1; vector<int> arr; arr.push_back(0); arr.push_back(1); arr.push_back(2); arr.push_back(2); for(int i=3;i<60000;i++){ for(int j=0;j<arr[i];j++) arr.push_back(i); } long long n; scanf("%lld", &n); int k; long long sum=0; for(int i=1;i<arr.size();i++){ sum+=arr[i]; if(sum>n){ k=i; break; } } ll ans=1; for(int i=1;i<k;){ ll cnt=arr[arr[i]]; if(i+cnt>k) cnt=1; ll now=1; for(int j=i;j<i+cnt;j++) now=(now*j)%mod; ans=(ans*_pow(now, arr[i]))%mod; n-=arr[i]*cnt; i+=cnt; } ans=(ans*_pow(k, n))%mod; printf("%lld\n", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 176 ms | 395316 KB | Output is correct |
2 | Correct | 149 ms | 395316 KB | Output is correct |
3 | Correct | 186 ms | 395316 KB | Output is correct |
4 | Correct | 193 ms | 395316 KB | Output is correct |
5 | Correct | 173 ms | 395316 KB | Output is correct |
6 | Correct | 189 ms | 395316 KB | Output is correct |
7 | Correct | 186 ms | 395316 KB | Output is correct |
8 | Correct | 213 ms | 395316 KB | Output is correct |
9 | Correct | 183 ms | 395316 KB | Output is correct |
10 | Correct | 193 ms | 395316 KB | Output is correct |
11 | Correct | 176 ms | 395316 KB | Output is correct |
12 | Correct | 176 ms | 395316 KB | Output is correct |
13 | Correct | 189 ms | 395316 KB | Output is correct |
14 | Correct | 213 ms | 395316 KB | Output is correct |
15 | Correct | 173 ms | 395316 KB | Output is correct |
16 | Correct | 173 ms | 395316 KB | Output is correct |
17 | Correct | 213 ms | 395316 KB | Output is correct |
18 | Correct | 183 ms | 395316 KB | Output is correct |
19 | Correct | 169 ms | 395316 KB | Output is correct |
20 | Correct | 179 ms | 395316 KB | Output is correct |
21 | Correct | 186 ms | 395316 KB | Output is correct |
22 | Correct | 196 ms | 395316 KB | Output is correct |
23 | Correct | 186 ms | 395316 KB | Output is correct |
24 | Correct | 209 ms | 395316 KB | Output is correct |
25 | Correct | 163 ms | 395316 KB | Output is correct |
26 | Correct | 189 ms | 395316 KB | Output is correct |
27 | Correct | 176 ms | 395316 KB | Output is correct |
28 | Correct | 193 ms | 395316 KB | Output is correct |
29 | Correct | 203 ms | 395316 KB | Output is correct |
30 | Correct | 193 ms | 395316 KB | Output is correct |
31 | Correct | 216 ms | 395316 KB | Output is correct |
32 | Correct | 176 ms | 395316 KB | Output is correct |
33 | Correct | 209 ms | 395316 KB | Output is correct |
34 | Correct | 166 ms | 395316 KB | Output is correct |
35 | Correct | 176 ms | 395316 KB | Output is correct |
36 | Correct | 179 ms | 395316 KB | Output is correct |
37 | Correct | 193 ms | 395316 KB | Output is correct |
38 | Correct | 176 ms | 395316 KB | Output is correct |
39 | Correct | 176 ms | 395316 KB | Output is correct |
40 | Correct | 153 ms | 395316 KB | Output is correct |
41 | Correct | 156 ms | 395316 KB | Output is correct |
42 | Correct | 196 ms | 395316 KB | Output is correct |
43 | Correct | 183 ms | 395316 KB | Output is correct |
44 | Correct | 189 ms | 395316 KB | Output is correct |
45 | Correct | 176 ms | 395316 KB | Output is correct |
46 | Correct | 156 ms | 395316 KB | Output is correct |
47 | Correct | 186 ms | 395316 KB | Output is correct |
48 | Correct | 176 ms | 395316 KB | Output is correct |
49 | Correct | 189 ms | 395316 KB | Output is correct |
50 | Correct | 156 ms | 395316 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 176 ms | 395316 KB | Output is correct |
2 | Correct | 149 ms | 395316 KB | Output is correct |
3 | Correct | 186 ms | 395316 KB | Output is correct |
4 | Correct | 193 ms | 395316 KB | Output is correct |
5 | Correct | 173 ms | 395316 KB | Output is correct |
6 | Correct | 189 ms | 395316 KB | Output is correct |
7 | Correct | 186 ms | 395316 KB | Output is correct |
8 | Correct | 213 ms | 395316 KB | Output is correct |
9 | Correct | 183 ms | 395316 KB | Output is correct |
10 | Correct | 193 ms | 395316 KB | Output is correct |
11 | Correct | 176 ms | 395316 KB | Output is correct |
12 | Correct | 176 ms | 395316 KB | Output is correct |
13 | Correct | 189 ms | 395316 KB | Output is correct |
14 | Correct | 213 ms | 395316 KB | Output is correct |
15 | Correct | 173 ms | 395316 KB | Output is correct |
16 | Correct | 173 ms | 395316 KB | Output is correct |
17 | Correct | 213 ms | 395316 KB | Output is correct |
18 | Correct | 183 ms | 395316 KB | Output is correct |
19 | Correct | 169 ms | 395316 KB | Output is correct |
20 | Correct | 179 ms | 395316 KB | Output is correct |
21 | Correct | 186 ms | 395316 KB | Output is correct |
22 | Correct | 196 ms | 395316 KB | Output is correct |
23 | Correct | 186 ms | 395316 KB | Output is correct |
24 | Correct | 209 ms | 395316 KB | Output is correct |
25 | Correct | 163 ms | 395316 KB | Output is correct |
26 | Correct | 189 ms | 395316 KB | Output is correct |
27 | Correct | 176 ms | 395316 KB | Output is correct |
28 | Correct | 193 ms | 395316 KB | Output is correct |
29 | Correct | 203 ms | 395316 KB | Output is correct |
30 | Correct | 193 ms | 395316 KB | Output is correct |
31 | Correct | 216 ms | 395316 KB | Output is correct |
32 | Correct | 176 ms | 395316 KB | Output is correct |
33 | Correct | 209 ms | 395316 KB | Output is correct |
34 | Correct | 166 ms | 395316 KB | Output is correct |
35 | Correct | 176 ms | 395316 KB | Output is correct |
36 | Correct | 179 ms | 395316 KB | Output is correct |
37 | Correct | 193 ms | 395316 KB | Output is correct |
38 | Correct | 176 ms | 395316 KB | Output is correct |
39 | Correct | 176 ms | 395316 KB | Output is correct |
40 | Correct | 153 ms | 395316 KB | Output is correct |
41 | Correct | 156 ms | 395316 KB | Output is correct |
42 | Correct | 196 ms | 395316 KB | Output is correct |
43 | Correct | 183 ms | 395316 KB | Output is correct |
44 | Correct | 189 ms | 395316 KB | Output is correct |
45 | Correct | 176 ms | 395316 KB | Output is correct |
46 | Correct | 156 ms | 395316 KB | Output is correct |
47 | Correct | 186 ms | 395316 KB | Output is correct |
48 | Correct | 176 ms | 395316 KB | Output is correct |
49 | Correct | 189 ms | 395316 KB | Output is correct |
50 | Correct | 156 ms | 395316 KB | Output is correct |
51 | Correct | 439 ms | 395316 KB | Output is correct |
52 | Correct | 443 ms | 395316 KB | Output is correct |
53 | Correct | 433 ms | 395316 KB | Output is correct |
54 | Correct | 389 ms | 395316 KB | Output is correct |
55 | Correct | 396 ms | 395316 KB | Output is correct |
56 | Correct | 379 ms | 395316 KB | Output is correct |
57 | Correct | 443 ms | 395316 KB | Output is correct |
58 | Correct | 456 ms | 395316 KB | Output is correct |
59 | Correct | 413 ms | 395316 KB | Output is correct |
60 | Correct | 423 ms | 395316 KB | Output is correct |
61 | Correct | 396 ms | 395316 KB | Output is correct |
62 | Correct | 419 ms | 395316 KB | Output is correct |
63 | Correct | 439 ms | 395316 KB | Output is correct |
64 | Correct | 423 ms | 395316 KB | Output is correct |
65 | Correct | 449 ms | 395316 KB | Output is correct |
66 | Correct | 453 ms | 395316 KB | Output is correct |
67 | Correct | 403 ms | 395316 KB | Output is correct |
68 | Correct | 433 ms | 395316 KB | Output is correct |
69 | Correct | 466 ms | 395316 KB | Output is correct |
70 | Correct | 466 ms | 395316 KB | Output is correct |
71 | Correct | 349 ms | 395316 KB | Output is correct |
72 | Correct | 389 ms | 395316 KB | Output is correct |
73 | Correct | 373 ms | 395316 KB | Output is correct |
74 | Correct | 343 ms | 395316 KB | Output is correct |
75 | Correct | 336 ms | 395316 KB | Output is correct |
76 | Correct | 363 ms | 395316 KB | Output is correct |
77 | Correct | 406 ms | 395316 KB | Output is correct |
78 | Correct | 389 ms | 395316 KB | Output is correct |
79 | Correct | 379 ms | 395316 KB | Output is correct |
80 | Correct | 403 ms | 395316 KB | Output is correct |
81 | Correct | 419 ms | 395316 KB | Output is correct |
82 | Correct | 399 ms | 395316 KB | Output is correct |
83 | Correct | 443 ms | 395316 KB | Output is correct |
84 | Correct | 253 ms | 395316 KB | Output is correct |
85 | Correct | 283 ms | 395316 KB | Output is correct |
86 | Correct | 289 ms | 395316 KB | Output is correct |
87 | Correct | 316 ms | 395316 KB | Output is correct |
88 | Correct | 299 ms | 395316 KB | Output is correct |
89 | Correct | 316 ms | 395316 KB | Output is correct |
90 | Correct | 303 ms | 395316 KB | Output is correct |
91 | Correct | 349 ms | 395316 KB | Output is correct |
92 | Correct | 363 ms | 395316 KB | Output is correct |
93 | Correct | 329 ms | 395316 KB | Output is correct |
94 | Correct | 353 ms | 395316 KB | Output is correct |
95 | Correct | 406 ms | 395316 KB | Output is correct |
96 | Correct | 316 ms | 395316 KB | Output is correct |
97 | Correct | 206 ms | 395316 KB | Output is correct |
98 | Correct | 233 ms | 395316 KB | Output is correct |
99 | Correct | 216 ms | 395316 KB | Output is correct |
100 | Correct | 236 ms | 395316 KB | Output is correct |
101 | Correct | 216 ms | 395316 KB | Output is correct |
102 | Correct | 256 ms | 395316 KB | Output is correct |
103 | Correct | 249 ms | 395316 KB | Output is correct |
104 | Correct | 226 ms | 395316 KB | Output is correct |
105 | Correct | 216 ms | 395316 KB | Output is correct |
106 | Correct | 226 ms | 395316 KB | Output is correct |
107 | Correct | 206 ms | 395316 KB | Output is correct |
108 | Correct | 266 ms | 395316 KB | Output is correct |
109 | Correct | 183 ms | 395316 KB | Output is correct |
110 | Correct | 209 ms | 395316 KB | Output is correct |
111 | Correct | 193 ms | 395316 KB | Output is correct |
112 | Correct | 159 ms | 395316 KB | Output is correct |
113 | Correct | 169 ms | 395316 KB | Output is correct |
114 | Correct | 183 ms | 395316 KB | Output is correct |
115 | Correct | 136 ms | 395316 KB | Output is correct |
116 | Correct | 206 ms | 395316 KB | Output is correct |
117 | Correct | 186 ms | 395316 KB | Output is correct |
118 | Correct | 199 ms | 395316 KB | Output is correct |
119 | Correct | 193 ms | 395316 KB | Output is correct |
120 | Correct | 186 ms | 395316 KB | Output is correct |