解题思路:
注意事项:
参考代码:
n,m=map(int,input().split()) def yunn(x): s =0 for i in range(2007,x): if i%100!=0 and i%4==0: s += 1 if i%400==0: s += 1 return s def isyun(n): if n%100!=0: if n%4==0: return 1 else: return 0 else: if n%400 ==0: return 1 else: return 0 def mnum(n,m): dy={1:31,2:29,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31} dp={1:31,2:28,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31} global numm if isyun(n)==0: days = dp[m] s=0 for i in range(1,m): s += dp[i] return [s,days] else: days = dy[m] s=0 for i in range(1,m): s += dy[i] return [s,days] num=(n-2007)*365+yunn(n)+mnum(n,m)[0] yu=num%7+1 print('''--------------------- Su Mo Tu We Th Fr Sa ---------------------''') print(' '*(yu*3),end='') g=7-yu+1 h=1 for i in range((mnum(n,m)[1]+yu)//7): for i in range(h,g): print('%3d'%i,end='') h =g g+=7 print() if (yu+mnum(n,m)[1])%7!=0: for i in range(h,mnum(n,m)[1]+1): print('%3d'%i,end='') print() print('---------------------') else: print('---------------------')
0.0分
0 人评分
C语言训练-排序问题<1> (C语言代码)浏览:636 |
打水问题 (C语言代码)浏览:1148 |
C语言训练-数字母 (C语言代码)浏览:648 |
关于float,double变量的几点说明浏览:1926 |
printf基础练习2 (C语言代码)浏览:547 |
蚂蚁感冒 (C语言代码)浏览:816 |
淘淘的名单 (C语言代码)浏览:1309 |
C语言程序设计教程(第三版)课后习题8.7 (C语言代码)浏览:852 |
C语言程序设计教程(第三版)课后习题8.6 (C语言代码)浏览:856 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:489 |