Contest Duration: - (local time) (100 minutes) Back to Home

Submission #817554

Source Code Expand

Copy
```#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include <vector>
#include <list>
#include <string>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <climits>
#include <map>
#include <math.h>

using namespace std;

int main(){
int n, k;
cin >> n >> k;

vector<int> d1 = {0,1,2,3,4,5,6,7,8,9};
vector<int> dd;

for (int i = 0; i < k; i++)
{
int t;
cin >> t;
d1[t] = -1;
}
for (int i = 0; i <10; i++)
{
if (d1[i] != -1){ dd.push_back(d1[i]); }
}

int digit[5] = { 0 };
digit[0] = dd[0];
int a = 0,b=-1,c=-1,d=-1,e=-1;
int size = dd.size();
bool f = false;

while (1){

int ans = digit[4] * 10000;
ans += digit[3] * 1000;
ans += digit[2] * 100;
ans += digit[1] * 10;
ans += digit[0];

if (ans >= n){ cout << ans << endl; return 0; }
a++;digit[0] = dd[a%size];
if (a%size == 0){ f = true; }
int tmp = b;
if (f == true){ b++; digit[1] = dd[b%size]; if (b%size != 0 || tmp < 0){ f = false; } else{ f = true; tmp = c; } }
if (f == true){ c++; digit[2] = dd[c%size]; if (c%size != 0 || tmp <0){ f = false; } else { f = true; tmp = d; } }
if (f == true){ d++; digit[3] = dd[d%size]; if (d%size != 0 || tmp <0){ f = false; } else { f = true; tmp = e; } }
if (f == true){ e++; digit[4] = dd[e%size]; if (e%size != 0 || tmp <0){ f = false; } else { f = true;  } }

}

return 0;
}```

#### Submission Info

Submission Time 2016-07-23 23:25:42+0900 C - Iroha's Obsession NNN C++14 (GCC 5.4.1) 300 1407 Byte AC 5 ms 256 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status AC
 AC × 10
Set Name Test Cases
Sample