尝试一下简单小题目——
void CaculateWeekDay(int y,int m,int d) { if(m==1||m==2){ m+=12; y–; } int iWeek=(d+2m+3(m+1)/5+y+y/4-y/100+y/400)%7; switch(iWeek){ case 0: printf(“Monday\n”); break; case 1: printf(“Tuesday\n”); break; case 2: printf(“Wednesday\n”); break; case 3: printf(“Thursday\n”); break; case 4: printf(“Friday\n”); break; case 5: printf(“Saturday\n”); break; case 6: printf(“Sunday\n”); break; } } int main() { int year=0,month=0,day=0; scanf(“%d-%d-%d”,&year,&month,&day); CaculateWeekDay(year,month,day); return 0; }
1582-10-15以前的测试数据有误。如果使用Java导致WA的请直接使用C/CPP的错误模板去将错就错。 http://acm.ecnu.edu.cn/blog/entry/50/
Python的datetime也是假的…
=-= 卡在第三个测试案例…
尝试一下简单小题目——
include
void CaculateWeekDay(int y,int m,int d)
{
if(m==1||m==2){
m+=12;
y–;
}
int iWeek=(d+2m+3(m+1)/5+y+y/4-y/100+y/400)%7;
switch(iWeek){
case 0: printf(“Monday\n”); break;
case 1: printf(“Tuesday\n”); break;
case 2: printf(“Wednesday\n”); break;
case 3: printf(“Thursday\n”); break;
case 4: printf(“Friday\n”); break;
case 5: printf(“Saturday\n”); break;
case 6: printf(“Sunday\n”); break;
}
}
int main()
{
int year=0,month=0,day=0;
scanf(“%d-%d-%d”,&year,&month,&day);
CaculateWeekDay(year,month,day);
return 0;
}
1582-10-15以前的测试数据有误。如果使用Java导致WA的请直接使用C/CPP的错误模板去将错就错。
http://acm.ecnu.edu.cn/blog/entry/50/
Python的datetime也是假的…
=-= 卡在第三个测试案例…