Submission #815601


Source Code Expand

Copy
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz size()
#define all(a)  a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mod 1000000007
#define _for(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)

using namespace std;

bool p[15];

bool check(int x){
   if(x == 0){
      if(p[x] == 0) return true;
      return false;
   }
   while(x){
      if(p[x % 10] == 1) return false;
      x /= 10;
   }
   return true;
}

int main(){
   int N, M;
   cin >> N >> M;
   int x;
   for(int n = 1; n <= M; ++n){
      scanf("%d", &x);
      p[x] = 1;
   }
   int st = N;
   while(true){
      if(check(N)) break;
      ++N;
   }
   cout << N << endl;
   return 0;
}

Submission Info

Submission Time
Task C - Iroha's Obsession
User achaitanyasai
Language C++14 (GCC 5.4.1)
Score 300
Code Size 795 Byte
Status AC
Exec Time 4 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:33:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
       scanf("%d", &x);
                      ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status AC
AC × 10
Set Name Test Cases
Sample
All subtask0_sample_01.txt, subtask0_sample_02.txt, subtask1_X_01.txt, subtask1_X_02.txt, subtask1_X_03.txt, subtask1_X_04.txt, subtask1_X_05.txt, subtask1_X_06.txt, subtask1_X_07.txt, subtask1_X_08.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt AC 4 ms 256 KB
subtask0_sample_02.txt AC 4 ms 256 KB
subtask1_X_01.txt AC 4 ms 256 KB
subtask1_X_02.txt AC 4 ms 256 KB
subtask1_X_03.txt AC 4 ms 256 KB
subtask1_X_04.txt AC 4 ms 256 KB
subtask1_X_05.txt AC 4 ms 256 KB
subtask1_X_06.txt AC 4 ms 256 KB
subtask1_X_07.txt AC 4 ms 256 KB
subtask1_X_08.txt AC 4 ms 256 KB