-
Notifications
You must be signed in to change notification settings - Fork 1
/
06812.cpp
44 lines (37 loc) · 854 Bytes
/
06812.cpp
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <string>
#include <utility>
using namespace std;
const pair<string, int> p[] = {
{"Ottawa", 0},
{"Victoria", -300},
{"Edmonton", -200},
{"Winnipeg", -100},
{"Toronto", 0},
{"Halifax", 100},
{"St. John's", 130}
};
inline int mod24(int x) {
return (x + 24) % 24;
}
inline string time(int h, int m) {
if (h == 0 && m == 0) return "0";
if (h == 0) return to_string(m);
if (m == 0) return to_string(h) + "00";
return to_string(h) + to_string(m);
}
void solve(void) {
int n; cin >> n;
for (int i=0; i<7; i++) {
int h = mod24(n / 100 + p[i].second / 100);
int m = n % 100 + p[i].second % 100;
if (m >= 60) h = mod24(h+1), m -= 60;
cout << time(h, m) << " in " << p[i].first << "\n";
}
}
int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}