1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| #include <iostream>
using namespace std;
int main(){ int daysOfMonth[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; string days[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; int cases; cin >> cases; while(cases--){ int m, d; cin >> m >> d; int current_m=1, current_d=1, day = 6; while(current_m != m){ day += daysOfMonth[current_m]; ++current_m; } while(current_d != d){ ++day; ++current_d; } day %= 7; cout << days[day] << '\n'; } return 0; }
|