admin管理员组文章数量:1612836
http://codeforces/problemset/problem/271/A
import java.util.Scanner;
public class Beautiful_Year {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int y = scanner.nextInt();
while(true) {
int temp = ++y;
if(check(temp)) {
System.out.println(temp);
break;
}
}
}
public static boolean check(int y ) {
int[] a = new int[4];
int i = 0;
while(y > 0) {
a[i++] = y % 10;
y = y /10;
}
for(int k = 0; k < i; k++) {
for(int p = k+1; p < i; p++) {
if(a[k] == a[p]) {
return false;
}
}
}
return true;
}
}
本文标签: CoferforcesBeautifulYear
版权声明:本文标题:Coferforces Beautiful Year 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1728632029a1167189.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论