#!Usr/bin/env python # -*- coding:utf-8 -*- # Author:Alex Li '''一个整数,它加上100后是一个完全平方数,再加上268又是一个完全平方数,请问该数是多少?: ''' for i in range(1,1000): for j in range(1,1000): if i+100==j**2 : for l in range(1,1000): if i+268==l**2: print(i) ''' 输入某年某月某日,判断这一天是这一年的第几天? ''' ''' year_=input('\033[41;1m year:\033[0m') month_=input('\033[41;1m month:\033[0m') day_=input('\033[41;1m day::\033[0m') year_=int(year_) month_=int(month_) day_=int(day_) if month_==1: a=day_ elif 1<month_<=2: a=31+day_ elif 2<month_<=3: a=31+28+day_ elif 3<month_<=4: a=31+28+31+day_ elif 4 < month_ <= 5: a = 31 + 28 + 31 + day_+30 elif 5< month_ <= 6: a= 31 + 28 + 31 + day_ + 30+31 elif 6< month_ <= 7: a= 31 + 28 + 31 + day_ + 30 + 31+30 elif 7< month_ <= 8: a= 31 + 28 + 31 + day_ + 30 + 31 + 30+31 elif 8 < month_ <= 9: a= 31 + 28 + 31 + day_ + 30 + 31 + 30 + 31+31 elif 9 < month_ <= 10: a= 31 + 28 + 31 + day_ + 30 + 31 + 30 + 31 + 31+30 elif 10< month_ <= 11: a= 31 + 28 + 31 + day_ + 30 + 31 + 30 + 31 + 31 + 30+31 elif 11 < month_ <= 12: a= 31 + 28 + 31 + day_ + 30 + 31 + 30 + 31 + 31 + 30 + 31+30 if (year_%4==0 and year_%100!=0) or year_%400==0: a-=1 print(a) else: print(a) ''' #MD上面是我写的傻逼代码 year=int(input('year:\n')) month=int(input('month:\n')) day=int(input('day:\n')) months=(0,31,59,90,120,151,181,212,243,273,304,334) if 0<=month<=12: sum=months[month-1] else: print('data error') sum+=day leap=0 if(year%4==0 and year%100!=0)or year%400==0: leap=1 if(leap==1)and (month>2): sum+=1 print('\033[41;1m it is the %dth day\033[0m'%sum)#\033[41;1m day::\033[0m