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

Submission #817112

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 };
int a = 0,b=0,c=0,d=0,e=0;
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; }
if (f == true){ b++; digit[1] = dd[b%size];if (b%size != 0){ f = false; } else{ f = true; } }
if (f == true){ c++; digit[2] = dd[c%size];if (c%size != 0){ f = false; } else { f = true; } }
if (f == true){ d++; digit[3] = dd[d%size];if (d%size != 0){ f = false; } else { f = true; } }
if (f == true ){ e++; digit[4] = dd[e%size];if (e%size != 0){ f = false; } else { f = true; } }

}

return 0;
}```

#### Submission Info

Submission Time 2016-07-23 22:30:23+0900 C - Iroha's Obsession NNN C++14 (GCC 5.4.1) 0 1292 Byte WA 4 ms 256 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status AC
 AC × 7 WA × 3
Set Name Test Cases
Sample