Advertisement
rengetsu

Codeforces_271A

Jul 25th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. //Codeforces Round 271A
  2. #include <string>
  3. #include <cstring>
  4. #include <iostream>
  5. using namespace std;
  6. int main()
  7. {
  8.     int n;
  9.     char mass[4];
  10.     cin >> n;
  11.     for(int i=0;i<10000;i++)
  12.     {
  13.         n++;
  14.         string s = to_string(n);
  15.         strcpy(mass, s.c_str());
  16.         if(mass[0]!=mass[1] && mass[0]!=mass[2] && mass[0]!=mass[3] && mass[1]!=mass[2] && mass[1]!=mass[3] && mass[2]!=mass[3])
  17.         {
  18.             cout << mass;
  19.             break;
  20.         }
  21.     }
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement