-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy path271 A. Beautiful Year.cpp
More file actions
47 lines (34 loc) · 877 Bytes
/
271 A. Beautiful Year.cpp
File metadata and controls
47 lines (34 loc) · 877 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
45
46
47
//============================================================================
//problem link:http://codeforces.com/problemset/problem/271/A
// Name : .cpp
// Author : mohand sakr
// Version :
// Copyright : use it under your responsibility
// Description : Hello World in C++, Ansi-style
//status:accepted
//============================================================================
#include <iostream>
#include<string>
#include<algorithm>
using namespace std;
bool isbuaty(int n){
string s =to_string(n);
int digt1=count(s.begin(),s.end(),s[0]);
int digt2=count(s.begin(),s.end(),s[1]);
int digt3=count(s.begin(),s.end(),s[2]);
int digt4=count(s.begin(),s.end(),s[3]);
if((digt1==1)&&(digt2=1)&&(digt3==1)&&(digt4==1))
return 1;
else
return 0;
}
int main() {
int n;
cin>>n;
++n;
while(!isbuaty(n)){
++n;
}
cout<<n;
return 0;
}