답안 #118552

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
118552 2019-06-19T08:08:28 Z 임유진(#2901) 수열 (BOI14_sequence) C++14
9 / 100
874 ms 512 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){
			if(K==1) printf("9");
			else{
				int ans=89;
				for(int x=11; x<K; x*=10) ans*=10;
				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 256 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 3 ms 256 KB Output is correct
8 Correct 16 ms 256 KB Output is correct
9 Correct 2 ms 256 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 256 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 17 ms 256 KB Output is correct
15 Correct 16 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 7 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Incorrect 17 ms 384 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 3 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Incorrect 874 ms 512 KB Output isn't correct
6 Halted 0 ms 0 KB -