Beautiful year 271A solution in cpp

Revision en1, by kahkasha, 2020-09-26 11:37:19

include

#include #include #include<bits/stdc++.h> using namespace std;

int main() { int n; int a,b,c,d; cin>>n;

while(true) { n++; a=n%10; b= (n/10)%10; c= (n/100)%10; d= (n/1000)%10; if(a!=b && a!=c && a!=d && b!=c && b!=d && c!=d) break;

} cout<<n; return 0; }

Tags #brute force

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English kahkasha 2020-09-26 11:37:19 425 it's a simple problem in which you have to iterate until the conditions satisfied (published)