mirror of
https://github.com/tiennm99/codeforces.git
synced 2026-10-11 16:12:51 +00:00
[Init] Solved solutions
This commit is contained in:
1 parent
51f667ac81
commit
20542601dd
131 files changed
+4148
No files matched your search
@@ -0,0 +1,36 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool check(int n)
|
||||
{
|
||||
int a = n/1000;
|
||||
int b = (n/100)%10;
|
||||
if (b == a)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int c = (n/10)%10;
|
||||
if (c == a || c == b)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int d = n%10;
|
||||
if (d == a || d == b || d == c)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
cin >> n;
|
||||
do
|
||||
{
|
||||
n++;
|
||||
} while (check(n) == 0);
|
||||
cout << n;
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user