Submission #118515

# Submission time Handle Problem Language Result Execution time Memory
118515 2019-06-19T06:43:52 Z 이온조(#2899) Sequence (BOI14_sequence) C++14
9 / 100
6 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 = 1;
	if(B[0] == 9) {
		while(l < K) l *= 10, ++l;
		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]);
                         ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 356 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 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 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 256 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 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 512 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Incorrect 2 ms 384 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 Incorrect 3 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 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 256 KB Output is correct
5 Incorrect 6 ms 512 KB Output isn't correct
6 Halted 0 ms 0 KB -