-
Notifications
You must be signed in to change notification settings - Fork 0
/
Beautiful Year.cpp
59 lines (51 loc) · 1.46 KB
/
Beautiful Year.cpp
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// https://codeforces.com/contest/271/problem/A
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define ll long long
#define pll pair<long, long>
#define vll vector<long long>
#define inf 1e18
#define gcd(a, b) __gcd(a, b)
#define range(a,b) substr(a,b-a+1)
#define fori(a, n) for (ll i = a; i < n; i++)
#define forj(a, n) for (ll j = a; j < n; j++)
#define fork(a, n) for (ll k = a; k < n; k++)
#define print(x) for (auto i : x) {cout << i << " ";}
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
template <class T>
bool comp(T a, T b) {
if (a < b)
return true;
return false;
}
bool ans(ll t)
{
string s = to_string(t);
if (count(all(s), s[0]) > 1)
return false;
if (count(all(s), s[1]) > 1)
return false;
if (count(all(s), s[2]) > 1)
return false;
return true;
}
int main()
{
FIO;
#ifndef ONLINE_JUDGE
//remove this piece of code when this has to be submitted in kickstart, coding ninjas
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
//freopen is used to associate a file with stdin or stdout stream in C++
#endif
ll t;
cin >> t;
while (!ans(++t)) {}
cout << t;
return 0;
}