제출 #103511

#제출 시각아이디문제언어결과실행 시간메모리
103511wilwxkSequence (BOI14_sequence)C++11
9 / 100
4 ms640 KiB
#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=1; base<=MAXN; base++) {
		if(testa(base)) {
			printf("%d\n", base);
			break;
		}
	}


}

컴파일 시 표준 에러 (stderr) 메시지

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]);
                          ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...