top of page

CCC 2016 J4: Arrival Time

The problem is a math problem.

1. Transfer 7:00 and 10:00 to 420 and 600 minutes.

Transfer 15:00am and 19:00am to 900 and 1140 minutes.

All the above minutes' range is the slow time area.

2. Input time and transfer it to minutes, it is the start time.

3. Normally it takes 120 minutes, but slowly it takes 240 minutes, Set a counter D

to 240, then move one minute by one minute for the start time till D is 0. if the start time is slow, D minus 1, otherwise minus 2.

4. Transfer the start time to HH: MM with 24 hours format.

5. print the result.




slow1s = 7*60
slow1e = 10*60
slow2s = 15*60
slow2e = 19*60

sinput = input().split(":")
startt = int(sinput[0])*60 + int(sinput[1])

D = 240
while D > 0:
    if startt > slow1s and startt < slow1e:
        D -= 1
    elif startt > slow2s and startt < slow2e:
        D -= 1
    else:
        D -= 2
    startt += 1

if startt %10 == 9:
    startt += 1

s = ""
h = startt//60%24
m = startt%60

if h < 10:
    s = "0"+str(h)+":"
else:
    s = str(h) + ":"

if m < 10:
    s += "0"+str(m)
else:
    s += str(m)

print(s)


Recent Posts

See All

CCC '24 J5 - Harvest Waterloo

#include<iostream> #include <vector> #include <algorithm> #include <cmath> #include <stack> using namespace std; int main() { int r, c, sr, sc; cin >> r; cin >> c; int p[r][c]; bool v

CCC '24 J4 - Troublesome Keys

#include <iostream> #include <string> #include <map> #include <vector> #include <algorithm> #include <cmath> using namespace std; int main() { string ps; string ds; cin >> ps; cin >> ds;

CCC '22 J5 - Square Pool

#include<iostream> #include <vector> #include <algorithm> #include <cmath> using namespace std; bool rowcom(pair<int, int> a, pair<int, int> b){ return a.first < b.first; } bool colcom(pair<int,

Comments


bottom of page