1114 -- 水仙花数
2015-08-30 10:23
225 查看
水仙花数
Time Limit:1000MS Memory Limit:65536K
Total Submit:627 Accepted:201
Description
输出区间[a,b】中的所有水仙花数,若三位数ABC满足ABC=A^3+B^3+C^3,则称为水仙花数。例如153=1^3+5^3+3^3,所以 153是水仙花数
Input
一个区间【a,b】,b>a>0
Output
输出区间[a,b】中的所有水仙花数(每一个1行)
Sample Input
Sample Output
Hint
153
Source
lrj程序入门
Time Limit:1000MS Memory Limit:65536K
Total Submit:627 Accepted:201
Description
输出区间[a,b】中的所有水仙花数,若三位数ABC满足ABC=A^3+B^3+C^3,则称为水仙花数。例如153=1^3+5^3+3^3,所以 153是水仙花数
Input
一个区间【a,b】,b>a>0
Output
输出区间[a,b】中的所有水仙花数(每一个1行)
Sample Input
100 154
Sample Output
Hint
153
Source
lrj程序入门
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AK1114 { class Program { static void Main(string[] args) { int a, b, x, y, z, i; string[] values = Console.ReadLine().Split(' '); a = int.Parse(values[0]); b = int.Parse(values[1]); if (a < 100) a = 100; if (b > 999) b = 999; for (i = a; i <= b; i++) { x = i / 100; y = i / 10 % 10; z = i % 10; if (x * x * x + y * y * y + z * z * z == i) Console.WriteLine(i); } } } }
相关文章推荐
- 1113 -- 位数
- composer安装(中国镜像)
- 【笔试】34、反转链表
- Citrix xendesktop静态分发模式下合理管控分配虚拟桌面本地管理员权限
- 622 Vote【贪心】
- 程序员面试金典2.1:编写代码,移除未排序的链表中的重复节点
- 1112 -- 简单数据统计
- hibernate——继承关系以及三个subclass标签的区别- 一对多,多对多
- zzuli OJ 1080: a+b(多实例测试3)
- 单链表反转
- Cookie/Session的机制与安全
- AngularJS 表单(ng-form)验证
- 二分图学习小结
- 1111 -- 阶乘之和
- 1110 -- 3n+1中文版(简化版)
- zzuli OJ 1079: a+b(多实例测试2)
- JavaScript 设计模式之----单体(单例)模式
- 【笔试】33、链表中倒数第k个结点
- IE8下jQuery改变png图片透明度时出现的黑边问题
- poj 1159 Palindrome 最长公共子序列 滚动数组