답안 #118554

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
118554 2019-06-19T08:12:02 Z 임유진(#2901) 수열 (BOI14_sequence) C++14
34 / 100
926 ms 768 KB
#include<stdio.h>

#define MAXN 100005

int B[MAXN];
bool s=true;

int main(){
	int K;
	
	scanf("%d", &K);
	for(int i=0; i<K; i++) scanf("%d", B+i);

	for(int i=1; i<K; i++) if(B[i]!=B[i-1]) s=false;
	if(s){
		if(B[0]==0){
			int ans=10;
			for(int x=1; x<K; x=x*10+1) ans*=10;
			printf("%d", ans);
		}
		else if(B[0]==9){
			int ans=9;
			for(int x=1; x<K; x=x*10+1) ans=ans*10-1;
			printf("%d", ans);
		}
		else{
			int ans=B[0];
			for(int x=1; x<K; x*=10) ans*=10;
			printf("%d", ans);
		}
		return 0;
	}

	for(int i=1; i<=1000; i++){
		bool a=true;
		for(int j=0; j<K; j++){
			bool b=false;
			for(int k=1; k<=i+j; k*=10) if(((i+j)/k)%10==B[j]){
				b=true;
			}
			if(!b) a=false;
		}
		if(a){
			printf("%d\n", i);
			return 0;
		}
	}
	return 0;
}

Compilation message

sequence.cpp: In function 'int main()':
sequence.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &K);
  ~~~~~^~~~~~~~~~
sequence.cpp:12:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0; i<K; i++) scanf("%d", B+i);
                         ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 6 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 16 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 17 ms 384 KB Output is correct
15 Correct 17 ms 484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Incorrect 17 ms 256 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 8 ms 640 KB Output is correct
8 Correct 6 ms 512 KB Output is correct
9 Correct 10 ms 768 KB Output is correct
10 Correct 10 ms 736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 6 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Incorrect 926 ms 512 KB Output isn't correct
6 Halted 0 ms 0 KB -