#include <iostream>
#include <string>
#include <set>
using namespace std;
bool is_in(int x,int y)
{
string s=to_string(x);
string yp="";
yp+=char(y+'0');
return s.find(yp)!=string::npos;
}
int main()
{
int n;
cin>>n;
int b[n];
set<int> sp;
for(int i=0;i<n;i++)
{
// cin>>b[i];
b[i]=9;
sp.insert(b[i]);
}
if(sp.size()==1)
{
int tp=1;
while((tp*10)<=n)
{
tp*=10;
}
if(tp!=n)
tp*=10;
if(b[0] and tp>1)
{
cout<<(((tp*10)-1)/9)*8+1<<endl;
}
else{
cout<<tp*b[0]<<endl;
}
return 0;
}
for(int ans=1;ans<=1e6;ans++)
{
bool pos=1;
for(int j=0;j<n;j++)
{
if(!is_in(ans+j,b[j]))
{
pos=0;
break;
}
}
if(pos)
{
cout<<ans<<endl;
break;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |