1 import "strconv" 2 3 func IsLeapYear(y string)
bool { //y == 2000, 2004 4 //判断是否为闰年 5 year, _ := strconv.Atoi(y) 6 if year%4 ==
0 && y...
分类:
其他好文 时间:
2014-05-26 15:12:52
阅读次数:
230
好吧题目很简单,但是有些细节还是挺有意思的。题目是:计算今年是否是闰年,判断闰年条件,满足年份模400为0,或者模4为0但是模100不为0答案是这样的:import time
#计算今年是否是闰年,判断闰年条件,满足年份模400为0,或者模4为0但是模100不为0
thisyear = time.localtime()[0] #获取年份
if thisyear%400==0 or this...
分类:
编程语言 时间:
2014-05-22 11:30:26
阅读次数:
326
#include
using namespace std;
int func(int year)//判断闰年的个数
{
int count=0;
for(int i=1990;i
if(year%4==0&&year%100!=0||year%400==0)
count++;
return cou...
分类:
其他好文 时间:
2014-05-22 06:34:15
阅读次数:
252
//转换函数如下
int dayofyear(int year, int month, int day){
//k月份 leap判断闰年
int k, leap;
int tab[2][13] = {
{ 0,31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
{ 0,31, 29, 31, 30, 31, 30, 31, 31, 30,...
分类:
其他好文 时间:
2014-05-18 18:27:41
阅读次数:
278