Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma GCC optimized("Ofast, unroll-loops")
- #include <bits/stdc++.h>
- using namespace std;
- #define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
- #define X first
- #define Y second
- #define Push push_back
- #define ALL(x) x.begin(), x.end()
- using lli = long long;
- using pll = pair<lli, lli>;
- using Double = long double;
- template<typename T>
- using Vector = vector<vector<T>>;
- template<typename T>
- using prior = priority_queue<T>;
- int main() {
- IOS;
- vector<string> ans{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
- int month[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
- int year[] = {1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0}; // 2100,2101,...
- int yearToDate[] = {4, 6, 0, 1, 2, 4, 5, 6, 0, 2, 3, 4, 5, 0, 1, 2, 3, 5, 6, 0, 1, 3, 4};
- for (int i = 1; i <= 12; ++i) month[i] += month[i - 1];
- int t, y, m, d;
- string s;
- cin >> t;
- while (t--) {
- cin >> s;
- y = stoi(s.substr(0, 4));
- m = stoi(s.substr(5, 2));
- d = stoi(s.substr(8, 2));
- // 2112 01 01 Friday
- int passed = yearToDate[y - 2100] + month[m - 1] + d - 1;
- if (m > 2) passed += year[y - 2100];
- cout << ans[passed % 7] << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement