Hdoj2010水仙花数
来源:互联网 发布:淘宝网店图片处理软件 编辑:程序博客网 时间:2024/05/16 11:53
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNext()) {
int flag = 0;
int n = in.nextInt();
int m = in.nextInt();
for (int i = n; i <= m; i++) {
int a, b, c;
a = i % 10;
b = i / 10 % 10;
c = i / 100;
if (i == a * a * a + b * b * b + c * c * c) {
flag++;
if (flag > 1)
System.out.print(" " + i);
else
System.out.print(i);
}
}
if(flag==0)
System.out.println("no");
else
System.out.println();
}
}
}
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNext()) {
int flag = 0;
int n = in.nextInt();
int m = in.nextInt();
for (int i = n; i <= m; i++) {
int a, b, c;
a = i % 10;
b = i / 10 % 10;
c = i / 100;
if (i == a * a * a + b * b * b + c * c * c) {
flag++;
if (flag > 1)
System.out.print(" " + i);
else
System.out.print(i);
}
}
if(flag==0)
System.out.println("no");
else
System.out.println();
}
}
}
阅读全文
0 0
- Hdoj2010水仙花数
- HDOJ2010水仙花数
- hdoj2010(java)水仙花数 格式格式!!!!!!!!!!!!!!
- HDOJ2010水仙花数--水题(一)
- hdoj2010 水仙花
- hdoj2010
- HDOJ2010
- HDOJ2010
- hdoj2010
- HDOJ2010
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 最全的ORACLE-SQL笔记(转,出处不详)
- nyoj 111 分数加减法
- eclipse maven Tomcat 编译成功 运行,classnotfound
- 【semi join】IN/EXISTS子查询的区别及其优化方式
- SVN代码提交指南
- Hdoj2010水仙花数
- android 面试中或者开发中会提到关于内存泄漏或者内存溢出的问题
- JavaScript 基础知识
- Codeforces Round #425 (Div. 2)
- Qt实例digitalclock详解
- 交换类排序(冒泡排序及快速排序)
- 第一章:Chrome 浏览器 搭建 selenium 环境
- linkurious.js实现Louvain社区发现算法
- Eclipse进入debug模式提示45s超时的解决办法