蓝桥杯——基础训练之特殊的数字

package _2_base;

public class _7_SpecialNumber {
	public static void main(String[] args) {
		print();
	}
	public static void print() {
		int ge=0;
		int shi=0;
		int bai=0;
		for (int i = 100; i <=999; i++) {
			ge=i%10;
			shi=i/10%10;
			bai=i/100%10;
			if (Math.pow(ge, 3)+Math.pow(shi, 3)+Math.pow(bai, 3)==i) {
				System.out.println(i);
			}
		}
	}
}
发布了27 篇原创文章 · 获赞 2 · 访问量 935

猜你喜欢

转载自blog.csdn.net/wcy8733996wcy/article/details/104290321