Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #pragma GCC optimize("O3")
- #define endl "\n"
- #define endll "\n\n"
- #define pb push_back
- #define IO ios_base::sync_with_stdio(0);cin.tie(0)
- #define ll long long
- #define inf 0x3f3f3f3f
- #define MAXN inf
- #define DD(x) cout << #x << " = " << x << endl
- using namespace std;
- class Solution{
- public:
- private:
- };
- string subjects[] = {"籃球", "排球", "田徑", "羽桌球", "休閒活動", "足壘球"};
- string places[] = {"A場地", "排球場", "C場地", "中山堂", "E場地", "中山堂旁階梯"};
- int ds[] = {0, 31, 61, 92, 122, 153};
- signed main(){
- // IO;
- #ifdef DEBUG
- string rootPath = "./";
- freopen((rootPath+"t.in").c_str(), "r", stdin);
- freopen((rootPath+"t.out").c_str(), "w", stdout);
- #endif
- // TODO
- string error = "輸入錯誤";
- string inputMonth = "請輸入月份:";
- string inputDay = "請輸入日期:";
- int month, day, week;
- // while (cin >> month >> day){
- while (1){
- cout << inputMonth << endl; cin >> month;
- cout << inputDay << endl; cin >> day;
- month = month + (month==1?12:0) - 8;
- if (month < 0 || month > 5) {
- cout << error << endl; continue;
- }
- week = ds[month] + day - 26;
- if (week < 1 || week >= 21*7) {
- cout << error << endl; continue;
- }
- week = week/7 + 1;
- cout << "第" << week << "週" << endl;
- cout << "課程內容: " << subjects[week%6].c_str()
- << ", 上課地點: " << places[week%6].c_str() << endll;
- }
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment