把握今天,才能拥有明天!
#include <cstdio>
#include <cstring>char month[15][20] = { {}, {"January"}, {"February"}, {"March"}, {"April"}, {"May"}, {"June"}, {"July"}, {"August"}, {"September"}, {"October"}, {"November"}, {"December"}
};
char week[15][20] = { {"Monday"}, {"Tuesday"}, {"Wednesday"}, {"Thursday"}, {"Friday"}, {"Saturday"}, {"Sunday"}
};int main()
{int d, y, k;char m[15];while (scanf ("%d %s %d", &d, m, &y) != EOF) {for (int i = 0; i < 13; i++) {if (strcmp (month[i], m) == 0) k = i;} if (k == 1 || k == 2) { k += 12;y--;}int j = (d + 2 * k + 3 * (k + 1) / 5 + y + y / 4 - y / 100 + y / 400) % 7;printf ("%s\n", week[j]); }return 0;
}