Submission #105615

#TimeUsernameProblemLanguageResultExecution timeMemory
105615luciocf수열 (BOI14_sequence)C++14
9 / 100
9 ms428 KiB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e3+10;

int n;
int a[maxn];

int brute(void)
{
	for (int j = 1; j <= 1000; j++)
	{
		int v = j;	
		bool deu = 1;

		for (int i = 0; i < n; i++)
		{
			int aux = v;
			bool ok = 0;

			while (aux > 0)
			{
				if (aux%10 == a[i]) ok = 1;
				aux /= 10;
			}

			if (!ok) deu = 0;

			v++;
		}

		if (deu) return j;
	}
}

int main(void)
{
	scanf("%d", &n);

	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);

	if (n <= 1000)
	{
		printf("%d\n", brute());
		return 0;
	}

	int x = 1;
	for (int i = 0; i <= 20; i++)
	{
		if (x >= n)
		{
			printf("%d", a[0]);
			for (int j = 1; j <= i; j++) printf("0");
			printf("\n");

			return 0;
		}

		x *= 10;
	}
}

Compilation message (stderr)

sequence.cpp: In function 'int brute()':
sequence.cpp:35:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
sequence.cpp: In function 'int main()':
sequence.cpp:39:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
sequence.cpp:42:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a[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...