50,526
社区成员
发帖
与我相关
我的任务
分享
public class age {
public static void main(String[] args){
for (int i = 1800; i < 1900; i++) {
for (int j = 0; j < 100; j++) {
if(i+j == j*j){
System.out.println(i+" "+j);
return;
}
}
}
}
}
public class Age {
public static void main(String[] args) {
for (int x = 0; ; x++) {
int y = x * x - x;
if (y > 1830) {
break;
}
if (y > 1800) {
System.out.println(y + " " + x);
}
}
}
}
大概这样..