답안 #118514

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
118514 2019-06-19T06:38:41 Z 이온조(#2899) 수열 (BOI14_sequence) C++14
9 / 100
5 ms 512 KB
#include <bits/stdc++.h>
using namespace std;

int B[100009];

int main() {
	int K; scanf("%d",&K);
	for(int i=0; i<K; i++) scanf("%d",&B[i]);
	//*
	for(int i=1; i<=1000; i++) {
		for(int j=0; j<K; j++) {
			bool fl = 1;
			int ii = i+j;
			while(ii) {
				if(ii % 10 == B[j]) fl = 0;
				ii /= 10;
			}
			if(fl) goto hell;
		}
		printf("%d", i);
		return 0;
		hell:;
	}
	//*/
	
	int l = 10;
	if(B[0] == 9) {
		while(l+1 < K) l *= 10;
		while(l/10) {
			printf("8");
			l /= 10;
		}
		puts("9");
	}
	else if(B[0] == 0) {
		while(l+1 < K) l *= 10;
		printf("10");
		while(l/10) {
			printf("0");
			l /= 10;
		}
	}
	else {
		while(l < K) l *= 10;
		printf("%d", B[0]);
		while(l/10) {
			printf("0");
			l /= 10;
		}
	}
	return 0;
}

Compilation message

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