輸入一個日期,
輸出在2011年該日期是星期幾
--------------------------------------------------
/* 20150930
* hanting
* UVa 12019 - Doom's Day Algorithm
* C++
*/
#include <iostream>
using namespace std;
#define YearID(x) ((x-2000)/4+(x-2000))
int main()
{
int caseN;
cin>>caseN;
string Day[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
int MonID[]={0,6,2,2,5,0,3,5,1,4,6,2,4};
while(caseN--)
{
int mon,date;
cin>>mon>>date;
int ans=(YearID(2011)+ MonID[mon] + date )%7;
cout<<Day[ans]<<endl;
}
return 0;
}
沒有留言:
張貼留言