java 水仙花
来源:互联网 发布:ovid数据库优点 编辑:程序博客网 时间:2024/05/17 03:58
package first;
import java.util.Scanner;
public class First {
public static void main(String[] args) {
// TODO Auto-generated method stub
num();
getshuixianhuashu();
}
static void num()
{
int num;
for(int i=100;i<1000;i++)
{
num=i;
if(Math.pow((num%10),3)+Math.pow((num/100),3)+Math.pow((num/10%10),3)==i)
{
System.out.println(i);
}
}
}
static void getshuixianhuashu()
{
int a,b,c,n;
Scanner s1=new Scanner(System.in);
n=s1.nextInt();
for(int i=100;i<=n;i++)
{
String s=i+"";
char[] str=s.toCharArray();
a=str[0]-48;
b=str[1]-48;
c=str[2]-48;
if(Math.pow(a,3)+Math.pow(b,3)+Math.pow(c,3)==i)
{
System.out.println(i);
}
}
}
}
import java.util.Scanner;
public class First {
public static void main(String[] args) {
// TODO Auto-generated method stub
num();
getshuixianhuashu();
}
static void num()
{
int num;
for(int i=100;i<1000;i++)
{
num=i;
if(Math.pow((num%10),3)+Math.pow((num/100),3)+Math.pow((num/10%10),3)==i)
{
System.out.println(i);
}
}
}
static void getshuixianhuashu()
{
int a,b,c,n;
Scanner s1=new Scanner(System.in);
n=s1.nextInt();
for(int i=100;i<=n;i++)
{
String s=i+"";
char[] str=s.toCharArray();
a=str[0]-48;
b=str[1]-48;
c=str[2]-48;
if(Math.pow(a,3)+Math.pow(b,3)+Math.pow(c,3)==i)
{
System.out.println(i);
}
}
}
}
阅读全文
0 0
- java 水仙花
- java 水仙花
- JAVA水仙花数算法
- java中水仙花数
- java水仙花数
- Java打印水仙花数
- java实现水仙花数
- Java水仙花数
- java 打印水仙花数
- Java实现水仙花数
- java实现水仙花数
- java实现判断水仙花
- 水仙花数--java
- java:水仙花数打印
- 水仙花数Java
- 水仙花数-java实现
- Java 打印水仙花数
- JAVA-水仙花数
- 微信小程序入门-事件冒泡、模板、视图渲染
- 2017CCPC秦皇岛 E:String of CCPC
- Qt下MSVC/Mingw平台dump/crash log报告调试方法差异
- hdu 6225 Little Boxes
- String of CCPC(CCPC秦皇岛)
- java 水仙花
- 关于我的博客
- Anton and Chess CodeForces
- 关于Q群-昌盛街街民联合会
- jdbc和反射
- 欢迎使用CSDN-markdown编辑器
- 简单理解IIFE
- 重写UGUI按钮组件button的点击、选中事件
- LeetCode122. Best Time to Buy and Sell Stock II