[ 本帖最后由 卖报的小画家 于 2015-5-15 11:36 编辑 ]\n\n#include<stdio.h>
int leap(int a)
{
if(a%4==0&&a%100!=0||a%400==0) //判断闰年条件
return 1;
return 0;
}
int number(int year,int m,int d) //计算输入日期距离2006.1.1共有多少天
{
int sum=0,i,j,a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int b[12]={31,29,31,30,31,30,31,31,30,31,30,31};
if(leap(year)==1)
for(i=0; i<m-1; i++)
sum+=b[i];
else
for(i=0; i<m-1; i++)
sum+=a[i];
for(j=2006; j<year;j++)
if(leap(j)==1)
sum+=366;
else
sum+=365;
sum+=d;
return sum;
}
void main()
{
int year,month,day,n;
printf("请输入正确年月日\n");
scanf("%d%d%d", &year,&month,&day);
n=number(year,month,day);
if((n%5)<4 && (n%5)>0)
printf("%d:%d:%d 帅哥\n", year,month,day);
else
printf("%d:%d:%d 美女\n", year,month,day);
}
|