上一页 1 ··· 8 9 10 11 12

2017年9月30日

判断读入的年份是否为闰年,并输出1999~2999年中所有的闰年。 判断闰年的方法:能被4整除,但不能被100整除;或可以被400整除。

摘要: public static void main(String args[]){ for(int year=1999;year<2999;year++){ if(year%4==0 && year%100!=0 || year%400){ System.out.println(year); } } } 阅读全文

posted @ 2017-09-30 21:39 JETIME庚 阅读(1286) 评论(0) 推荐(0) 编辑

求1+2!+3!+...+20!的和

摘要: public static void main(String args[]){ long f=1; long sum=0; for(int i=0;i<=20;i++){ f*=i; sum+=f; } System.out.println(sum); } 阅读全文

posted @ 2017-09-30 21:34 JETIME庚 阅读(192) 评论(0) 推荐(0) 编辑

一个整数,它加上100后是一个完全平方数,再加上168又是一个完全平方数,请问该数是多少?

摘要: public static void main(String args[]){ for(int x=1;x<=10000;x++){ if(Math.sqrt(x+100)%1==0) if(Math.sqrt(x+268)%1==0) System.out.println(x); } } 阅读全文

posted @ 2017-09-30 21:27 JETIME庚 阅读(371) 评论(0) 推荐(0) 编辑

有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数,都是多少?

摘要: public static void main(String args[]){ for(int i=1;i<=4;i++){ for(int j=1;j<=4;j++){ for(int k=1;k<=4;k++){ if(i! = j && i !=k && j !=k){ System.out. 阅读全文

posted @ 2017-09-30 21:23 JETIME庚 阅读(307) 评论(0) 推荐(0) 编辑

九九乘法表

摘要: public static void main(String args[]){ for(int i=0;i<=9;i++){ for(int j=0;j<=i;j++){ System.out.print( i * j +" = "+i*j+"\t"); } System.out.println() 阅读全文

posted @ 2017-09-30 21:16 JETIME庚 阅读(134) 评论(0) 推荐(0) 编辑

2017年9月29日

python OSError: [Errno 22] Invalid argument: 'D:\\crawle\x01.html1'

摘要: import urllib.request file = urllib.request.open("http://www.baidu.com") data = file.read() print(data) fhandle = open("D:\crawle\html1","wb") fhandle 阅读全文

posted @ 2017-09-29 21:26 JETIME庚 阅读(2980) 评论(1) 推荐(0) 编辑

python 最简单的爬虫

摘要: import urllib.request file=urllib.request.urlopen("http://www.qq.com") data=file.read() dataline = file.readline() print(data) print(dataline) 阅读全文

posted @ 2017-09-29 20:38 JETIME庚 阅读(204) 评论(0) 推荐(0) 编辑

求1-50的偶数和,和奇数和

摘要: public static void main(String args[]){ int doubleNumber = 0; int singleNumber = 0; int i =1; while(i <= 50){ if(i %2==0){ doubleNumber+=i; }else{ sin 阅读全文

posted @ 2017-09-29 19:52 JETIME庚 阅读(1439) 评论(0) 推荐(0) 编辑

while 解决 10000米绳子 对折当 绳长小于5米时求绳的对折次数

摘要: public static void main(String args[]){ double length = 10000; int day = 0; while(day > 5){ length = length * 5; day++; } System.out.println(day); } 阅读全文

posted @ 2017-09-29 19:41 JETIME庚 阅读(239) 评论(0) 推荐(0) 编辑

上一页 1 ··· 8 9 10 11 12

导航