답안 #22406

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
22406 2017-04-30T04:26:29 Z 예제는 나오는데 왜 틀리죠??(#895, baactree) Fully Generate (KRIII5_FG) C++14
2 / 7
500 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 cnt=1;
	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;i++){
		ans=(ans*_pow(i, arr[i]))%mod;
		n-=arr[i];
	}
	ans=(ans*_pow(k, n))%mod;
	printf("%lld\n", ans);
	return 0;
}

Compilation message

FG.cpp: In function 'int main()':
FG.cpp:40:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1;i<arr.size();i++){
               ^
FG.cpp:25:6: warning: unused variable 'cnt' [-Wunused-variable]
  int cnt=1;
      ^
FG.cpp:26:6: warning: unused variable 'idx' [-Wunused-variable]
  int idx=1;
      ^
FG.cpp:37:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &n);
                   ^
FG.cpp:48:15: warning: 'k' may be used uninitialized in this function [-Wmaybe-uninitialized]
  for(int i=1;i<k;i++){
               ^
# 결과 실행 시간 메모리 Grader output
1 Correct 216 ms 395316 KB Output is correct
2 Correct 163 ms 395316 KB Output is correct
3 Correct 206 ms 395316 KB Output is correct
4 Correct 179 ms 395316 KB Output is correct
5 Correct 213 ms 395316 KB Output is correct
6 Correct 166 ms 395316 KB Output is correct
7 Correct 209 ms 395316 KB Output is correct
8 Correct 206 ms 395316 KB Output is correct
9 Correct 179 ms 395316 KB Output is correct
10 Correct 229 ms 395316 KB Output is correct
11 Correct 186 ms 395316 KB Output is correct
12 Correct 183 ms 395316 KB Output is correct
13 Correct 169 ms 395316 KB Output is correct
14 Correct 169 ms 395316 KB Output is correct
15 Correct 209 ms 395316 KB Output is correct
16 Correct 206 ms 395316 KB Output is correct
17 Correct 186 ms 395316 KB Output is correct
18 Correct 183 ms 395316 KB Output is correct
19 Correct 206 ms 395316 KB Output is correct
20 Correct 166 ms 395316 KB Output is correct
21 Correct 196 ms 395316 KB Output is correct
22 Correct 219 ms 395316 KB Output is correct
23 Correct 203 ms 395316 KB Output is correct
24 Correct 179 ms 395316 KB Output is correct
25 Correct 179 ms 395316 KB Output is correct
26 Correct 183 ms 395316 KB Output is correct
27 Correct 183 ms 395316 KB Output is correct
28 Correct 219 ms 395316 KB Output is correct
29 Correct 199 ms 395316 KB Output is correct
30 Correct 163 ms 395316 KB Output is correct
31 Correct 196 ms 395316 KB Output is correct
32 Correct 189 ms 395316 KB Output is correct
33 Correct 193 ms 395316 KB Output is correct
34 Correct 229 ms 395316 KB Output is correct
35 Correct 183 ms 395316 KB Output is correct
36 Correct 179 ms 395316 KB Output is correct
37 Correct 166 ms 395316 KB Output is correct
38 Correct 199 ms 395316 KB Output is correct
39 Correct 199 ms 395316 KB Output is correct
40 Correct 203 ms 395316 KB Output is correct
41 Correct 163 ms 395316 KB Output is correct
42 Correct 199 ms 395316 KB Output is correct
43 Correct 206 ms 395316 KB Output is correct
44 Correct 203 ms 395316 KB Output is correct
45 Correct 206 ms 395316 KB Output is correct
46 Correct 169 ms 395316 KB Output is correct
47 Correct 209 ms 395316 KB Output is correct
48 Correct 193 ms 395316 KB Output is correct
49 Correct 183 ms 395316 KB Output is correct
50 Correct 209 ms 395316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 216 ms 395316 KB Output is correct
2 Correct 163 ms 395316 KB Output is correct
3 Correct 206 ms 395316 KB Output is correct
4 Correct 179 ms 395316 KB Output is correct
5 Correct 213 ms 395316 KB Output is correct
6 Correct 166 ms 395316 KB Output is correct
7 Correct 209 ms 395316 KB Output is correct
8 Correct 206 ms 395316 KB Output is correct
9 Correct 179 ms 395316 KB Output is correct
10 Correct 229 ms 395316 KB Output is correct
11 Correct 186 ms 395316 KB Output is correct
12 Correct 183 ms 395316 KB Output is correct
13 Correct 169 ms 395316 KB Output is correct
14 Correct 169 ms 395316 KB Output is correct
15 Correct 209 ms 395316 KB Output is correct
16 Correct 206 ms 395316 KB Output is correct
17 Correct 186 ms 395316 KB Output is correct
18 Correct 183 ms 395316 KB Output is correct
19 Correct 206 ms 395316 KB Output is correct
20 Correct 166 ms 395316 KB Output is correct
21 Correct 196 ms 395316 KB Output is correct
22 Correct 219 ms 395316 KB Output is correct
23 Correct 203 ms 395316 KB Output is correct
24 Correct 179 ms 395316 KB Output is correct
25 Correct 179 ms 395316 KB Output is correct
26 Correct 183 ms 395316 KB Output is correct
27 Correct 183 ms 395316 KB Output is correct
28 Correct 219 ms 395316 KB Output is correct
29 Correct 199 ms 395316 KB Output is correct
30 Correct 163 ms 395316 KB Output is correct
31 Correct 196 ms 395316 KB Output is correct
32 Correct 189 ms 395316 KB Output is correct
33 Correct 193 ms 395316 KB Output is correct
34 Correct 229 ms 395316 KB Output is correct
35 Correct 183 ms 395316 KB Output is correct
36 Correct 179 ms 395316 KB Output is correct
37 Correct 166 ms 395316 KB Output is correct
38 Correct 199 ms 395316 KB Output is correct
39 Correct 199 ms 395316 KB Output is correct
40 Correct 203 ms 395316 KB Output is correct
41 Correct 163 ms 395316 KB Output is correct
42 Correct 199 ms 395316 KB Output is correct
43 Correct 206 ms 395316 KB Output is correct
44 Correct 203 ms 395316 KB Output is correct
45 Correct 206 ms 395316 KB Output is correct
46 Correct 169 ms 395316 KB Output is correct
47 Correct 209 ms 395316 KB Output is correct
48 Correct 193 ms 395316 KB Output is correct
49 Correct 183 ms 395316 KB Output is correct
50 Correct 209 ms 395316 KB Output is correct
51 Execution timed out 500 ms 395316 KB Execution timed out
52 Halted 0 ms 0 KB -