文章
64
粉丝
100
获赞
4
访问
36.1k
#include <bits/stdc++.h>
using namespace std;
int main() {
int year,month,day;
int b[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int a[16]={0};
scanf("%d %d %d",&year,&month,&day);
if((year%4==0&&year%100!=0)||year%400==0)
b[2]=29;
if(day>b[month])
day=b[month];
int i=15;
while(month>0)
{
a[i--]=month%2;
month=month/2;
}
i=11;
while(day>0)
{
a[i--]=day%2;
day=day/2;
}
int sum=year%100;
i=6;
while(sum>0)
{
a[i--]=sum%2;
sum=sum/2;
}
int aus=0;
for(int j=0;j<16;j++)
{
aus=aus*2+a[j];
}
printf("%d\n",aus);
}
登录后发布评论
暂无评论,来抢沙发