标签:names 等于 std als style ida clu string 大于等于
#include<cstdio> #include<string> using namespace std; int year, month, day; string ans[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; bool m[] = {false, true, false, true, false, true, false, true, true, false, true, false, true}; int main() { int sum = 0; while(~scanf("%d%d%d", &year, &month, &day)) { if((year == 0 || month == 0 || day == 0) || (month==2 && day>29) || (!m[month]&&day == 31) || (!((year%4==0 && year%100!=0) || year%400==0) && month==2 && day==29) ){ puts("illegal"); continue; } if(month < 3){ year -= 1; month += 12; } int c = year/100 , y = year % 100; int w = c/4 - 2*c + y/4 + y + (26*(month+1)/10) + day -1; cout<<ans[(w%7+7)%7]<<endl; } return 0; }
标签:names 等于 std als style ida clu string 大于等于
原文地址:https://www.cnblogs.com/mifankai/p/9568567.html