import java.io.*; /** * 从 100 循环到 1000,用三个 int 分别保存百位、十位和个位。 */ public class Main { public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); public static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out)); public static StreamTokenizer cin = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); public static PrintWriter cout = new PrintWriter(new OutputStreamWriter(System.out)); public static void main(String[] args) throws Exception { int a, b, c; int temp; for (int i = 100; i < 1000; i++) { temp = i; c = temp % 10; temp /= 10; b = temp % 10; temp /= 10; a = temp % 10; if (Math.pow(a, 3) + Math.pow(b, 3) + Math.pow(c, 3) == i) { cout.println(i); } } cout.flush(); } }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:1110 |
WU-整除问题 (C++代码)浏览:648 |
C语言程序设计教程(第三版)课后习题5.8 (C语言代码)浏览:683 |
字符逆序 (C语言代码)浏览:645 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:727 |
程序员的表白 (C语言代码)浏览:678 |
简单的a+b (C语言代码)浏览:857 |
敲七 (C++代码)浏览:1119 |
简单的事情 (C语言代码)浏览:679 |
排序算法(选择,插入,冒泡)浏览:876 |