답안 #103510

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
103510 2019-03-30T20:47:54 Z wilwxk 수열 (BOI14_sequence) C++11
0 / 100
5 ms 512 KB
#include <bits/stdc++.h>
using namespace std;

const int MAXN=5e3+3;
int v[MAXN];
int n;

bool acha(int val, int x) {
	while(val>=10) {
		if(val/10==x||val%10==x) return 1;
		val/=10;
	}
	return val==x;
}

bool testa(int k) {
	for(int i=1; i<=n; i++) {
		int cur=k+i-1;
		if(!acha(cur, v[i])) return 0;
	}
	return 1;
} 

int main() {
	scanf("%d", &n);
	for(int i=1; i<=n; i++) scanf("%d", &v[i]);

	for(int base=0; base<=MAXN; base++) {
		if(testa(base)) {
			printf("%d\n", base);
			break;
		}
	}


}

Compilation message

sequence.cpp: In function 'int main()':
sequence.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
sequence.cpp:26:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1; i<=n; i++) scanf("%d", &v[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 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Incorrect 2 ms 256 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Incorrect 2 ms 384 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 3 ms 384 KB Output is correct
5 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Halted 0 ms 0 KB -