zzuli OJ 1036:どのように多くの日の一定期間

タイトル説明は、
月の日数を見つけ、あなたの年と月を与えます

入力
途中でスペースで区切っ年(正の整数)、月(1-12)、

出力
月の日数、別の行。

サンプル入力
2012
サンプル出力
29

#include<stdio.h>
int main()
{
 int a,b,c;
 scanf("%d %d",&a,&b);
 if(b==2)
 {
  if((a%4==0&&a%100!=0)||a%400==0) c=29;
  else c=28;
 }
 else if(b==4||b==6||b==9||b==11) 
  c=30;
    else c=31;
 printf("%d\n",c);
 return 0;
}

公開された96元の記事 ウォン称賛22 ビュー40000 +

おすすめ

転載: blog.csdn.net/weixin_43751787/article/details/85318437