def get_month_year(x, y): if y in [1, 3, 5, 7, 8, 10, 12]: return 31 elif y in [4, 6, 9 ,11]: return 30 elif y == 2 and x%4 == 0 and x%100 != 0&nbs***bsp;x%400 == 0: return 29 else: return 28 while True: try: year, month = map(int,input().split()) print(get_month_year(year, month)) except: break;
dic = {'1':'31','2':['28','29'],'3':'31','4':'30','5':'31','6':'30', '7':'31','8':'31','9':'30','10':'31','11':'30','12':'31'} while True: try: data = input().strip(' ').split(' ') if data[1] != '2': print(dic[data[1]]) else: cur= int(data[0]) if cur % 4 == 0 and cur % 100 != 0: print(dic[data[1]][1]) elif cur % 100 == 0 and cur % 400 == 0: print(dic[data[1]][1]) else: print(dic[data[1]][0]) except: break
while True: try: year, month = map(int, input().split()) if month in (1, 3, 5, 7, 8, 10, 12): print(31) if month in (4, 6, 9, 11): print(30) if month == 2: # 只需判断一下闰年即可 if (year % 100 != 0 and year % 4 == 0)&nbs***bsp;(year % 400 == 0): print(29) else: print(28) except: break
def judge_days(a,b): if b != 2: if b in (1,3,5,7,8,10,12): print(31) else: print(30) elif a%100 == 0: if a%400 == 0: print(29) else: print(28) elif a%4 == 0: print(29) else: print(28) while True: try: year, month = map(lambda x:int(x),input().split(' ')) judge_days(year, month) except: break
#include <stdio.h> int year(int y) { return (((y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0))); } int main() { int y = 0; int m = 0; int d = 0; int days[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; while(scanf("%d %d", &y,&m)==2) { int d =days[m]; if((year(y)==1)&&(m==2)) { d++; } printf("%d\n",d); } return 0; }
#输出月份天数 def daynum(x,y): if (x%400==0) or (x%100!=0 and x%4==0): if y in [1,3,5,7,8,10,12]: return 31 elif y in [4,6,9,11]: return 30 else: return 29 else: if y in [1,3,5,7,8,10,12]: return 31 elif y in [4,6,9,11]: return 30 else: return 28 if __name__== '__main__': while True: try: x,y=map(int,input().split(" ")) res=daynum(x,y) print(res) except: break
li=[] while True: try: li.append(list(map(int, input().strip().split(' ')))) except: break leapyear=[31,29,31,30,31,30,31,31,30,31,30,31] averageyear=[31,28,31,30,31,30,31,31,30,31,30,31] for i in range(len(li)): if (li[i][0]%4==0 and li[i][0]%100!=0)&nbs***bsp;li[i][0]%400==0: print(leapyear[li[i][1]-1]) else: print(averageyear[li[i][1]-1])
#include <iostream> using namespace std; bool isLeap(int year) { if (year % 100 != 0) { return year % 4 == 0; } else { return year % 400 == 0; } } int main() { int year, month; int day[] = { 31,28,31,30,31,30,31,31,30,31,30,31 }; while (cin>> year >> month) { if (month != 2) { cout << day[month - 1] << endl; } else { if (isLeap(year)) { cout << 29 << endl; } else { cout << 28 << endl; } } } return 0; }