forked from itsprueba/Hacktoberfest
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathA_Beautiful_Year.cpp
More file actions
44 lines (42 loc) · 805 Bytes
/
A_Beautiful_Year.cpp
File metadata and controls
44 lines (42 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
void solve()
{
int n;
cin>>n;
for(int i=1000;i<=10000;i++)
{
if(i>n)
{
bool flag=true;
string s;
s=to_string(i);
sort(s.begin(),s.end());
for(int i=0;i<s.size()-1;i++)
{
if(s[i]==s[i+1])
{
flag=false;
}
}
if(flag)
{
cout<<i<<endl;
return;
}
}
}
}
int main()
{
ios_base::sync_with_stdio( false );
cin.tie(NULL);
int tt;
//cin>>tt;
tt=1;
while(tt--)
solve();
return 0;
}