萤火大盗(山理工)#include"stdio.h" main() { int t1,t3,t,n,y,r,m,h,g; scanf("%d%d%d",&n,&y,&r); m=(n-100)/100; g=(n-100)/400; h=(n-1)/4; t1=365*(n-1)+(h-m+g); t3=add(n,y); t=t1+r+t3-1; switch(t%7) {case 0:printf("所求星期为周一\n");break; printf("所求的天数为%d\n",t); case 1:printf("所求星期为周二\n");break;case 2:printf("所求星期为周三\n");break;case 3:printf("所求星期为周四\n");break;case 4:printf("所求星期为周五\n");break;case 5:printf("所求星期为周六\n");break;case 6:printf("所求星期为周日\n");break;} int add(int p,int q) {int t2; if(p/4==0&&p/100!=0||p/400==0) switch(q-1) 1 / 3 { case 0:t2=0;break;case 1:t2=31;break;} case 2:t2=60;break; case 3:t2=91;break; case 4:t2=121;break; case 5:t2=152;break; case 6:t2=182;break; case 7:t2=213;break; case 8:t2=244;break; case 9:t2=274;break; case 10:t2=305;break; case 11:t2=335;break; } else switch(q-1) {case 0:t2=0;break; case 1:t2=31;break; case 2:t2=59;break; case 3:t2=90;break; case 4:t2=120;break; case 5:t2=151;break; case 6:t2=181;break; case 7:t2=212;break; 2 / 3 case 8:t2=243;break; }case 9:t2=273;break; case 10:t2=304;break; case 11:t2=334;break; } return (t2); 3 / 3 本文来源:https://www.wddqw.com/doc/c9f8f416250c844769eae009581b6bd97e19bc32.html