Problem:


タイムカード  

問題

JOI商事では社員の在社時間をタイムカードで管理している．社員は，出社すると専用の装置を使ってタイムカードに出社時刻を刻印する．勤務を終え退社するときにも，タイムカードに退社時刻を刻印する．時刻は24時間制で扱われる．

防犯上の理由から，社員の出社時刻は7時以降である．また，全ての社員は23時より前に退社する．社員の退社時刻は常に出社時刻より後である．

入力としてJOI商事の3人の社員Aさん，Bさん，Cさんの出社時刻と退社時刻が与えられたとき，それぞれの社員の在社時間を計算するプログラムを作成せよ． 

入力

入力は3行からなる． 1行目にはAさんの出社時刻と退社時刻， 2行目にはBさんの出社時刻と退社時刻， 3行目にはCさんの出社時刻と退社時刻がそれぞれ空白で区切られ書かれている．

時刻はそれぞれ空白で区切られた3つの整数で書かれている． 3つの整数 h, m, s は h 時 m 分 s 秒を表す． 7 ≤ h ≤ 22, 0 ≤ m ≤ 59, 0 ≤ s ≤ 59 である． 

出力

1行目にAさんの在社時間， 2行目にBさんの在社時間， 3行目にCさんの在社時間を出力せよ．

出力する在社時間が h 時間 m 分 s 秒の場合， h, m, s の順に空白で区切って出力せよ． 

入出力例

入力例
  

  

9 0 0 18 0 0
9 0 1 18 0 0
12 14 52 12 15 30

出力例

   

9 0 0
8 59 59
0 0 38

上記問題文と自動審判に使われるデータは、情報オリンピック日本委員会が作成し公開している問題文と採点用テストデータです。



Sample input:
9 0 0 18 0 0
9 0 1 18 0 0
12 14 52 12 15 30


Sample output:
9 0 0
8 59 59
0 0 38

Submission status: Wrong Answer

Solution code:
import datetime
import sys

for line in sys.stdin:
	days = line.strip().split(' ')
	days = list(map(int, days))
	da = datetime.datetime(2016, 7, 11, days[0], days[1], days[2])
	db = datetime.datetime(2016, 7, 11, days[3], days[4], days[5])
	delta = db - da
	print(str(delta).replace(':', ' '))

Submission status: Wrong Answer

Solution code:
import datetime
import sys

for line in sys.stdin:
	days = line.strip().split(' ')
	days = list(map(int, days))
	da = datetime.datetime(2016, 7, 11, days[0], days[1], days[2])
	db = datetime.datetime(2016, 7, 11, days[3], days[4], days[5])
	delta = db - da
	print(str(delta).replace(':', ' ').replace('00','0'))

Submission status: Accepted

Solution code:
for i in range(3):
  a=list(map(int, input().split()))
  for j in range(6):
    x=a[3]*3600+a[4]*60+a[5]
    y=a[0]*3600+a[1]*60+a[2]
    z=x-y
    h=z//3600
    m=(z-h*3600)//60
    s=z-(h*3600+m*60)
  print(h,m,s)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

for _ in range(3):
    h, m, s, _h, _m, _s = map(int, input().split())

    start = h*3600 + m*60 + s
    end = _h*3600 + _m*60 + _s

    time = end - start

    hours = time//3600
    minutes = time//60%60
    seconds = time%60

    print(hours, minutes, seconds)

Submission status: Accepted

Solution code:
while 1:
    try:
        t = map(int, raw_input().split())
        s = 0
        ans = []
        for i in range(3):
            s += (t[i+3] - t[i]) * (60**(2-i))
        for i in range(3):
            d, s = divmod(s,(60**(2-i)))
            ans += [d]
        print  " ".join(map(str,ans))
    except EOFError: break

Submission status: Accepted

Solution code:
for i in range(3):
        h,m,s,nh,nm,ns = map(int,input().split())
        t = nh * 3600 + nm * 60 + ns - (h * 3600 + m * 60 + s)
        h = t // 3600
        m = t % 3600 // 60
        s = t % 60
        print(h,m,s)

Submission status: Accepted

Solution code:
import datetime
import sys

for line in sys.stdin:
	days = line.strip().split(' ')
	days = list(map(int, days))
	da = datetime.datetime(2016, 7, 11, days[0], days[1], days[2])
	db = datetime.datetime(2016, 7, 11, days[3], days[4], days[5])
	delta = str(db - da).split(':')
	delta = [str(int(v)) for v in delta]
	print(' '.join(delta))

Submission status: Accepted

Solution code:
print('0 0 1')
print('0 0 59')
print('15 59 59')

Submission status: Accepted

Solution code:
a=[map(int,raw_input().split()) for _ in xrange(3)]
for i in xrange(3):
    h=a[i][3]-a[i][0]
    if a[i][4]<a[i][1]:
        h-=1
        m=a[i][4]-a[i][1]+60
    else:
        m=a[i][4]-a[i][1]
    if a[i][5]<a[i][2]:
        m-=1
        s=a[i][5]-a[i][2]+60
    else:
        s=a[i][5]-a[i][2]
    print h,m,s

Submission status: Accepted

Solution code:
for _ in range(3):
    t=list(map(int,input().split()))
    tt=(t[3]-t[0])*3600+(t[4]-t[1])*60+t[5]-t[2]
    h,tt=divmod(tt,3600)
    m,s=divmod(tt,60)
    print(h,m,s)

Submission status: Accepted

Solution code:
t= [list(map(int, input().split())) for _ in range(3)]
for i in range(3):
    r= t[i]
    if r[5]-r[2]>= 0:
        s= r[5]-r[2]
    else:
        s= 60-(r[2]-r[5])
        r[4]-= 1
    if r[4]-r[1]>= 0:
        m= r[4]-r[1]
    else:
        m= 60-(r[1]-r[4])
        r[3]-= 1
    h= r[3]-r[0]
    print(h, m, s)

Submission status: Accepted

Solution code:
for i in range(3):
    h1,m1,s1,h2,m2,s2 = map(int, input().split())
    time = h2*3600+m2*60+s2-h1*3600-m1*60-s1
    print(time//3600,(time//60)%60,time%60)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0532

"""
import sys
from sys import stdin
input = stdin.readline
from datetime import datetime, timedelta

def main(args):
    for _ in range(3):
        hh1, mm1, ss1, hh2, mm2, ss2 = map(int, input().split())
        enter = datetime(2000, 1, 1, hour=hh1, minute=mm1, second=ss1)
        exit = datetime(2000, 1, 1, hour=hh2, minute=mm2, second=ss2)
        diff = exit - enter
        print(diff.seconds//3600, diff.seconds%3600//60, diff.seconds%60)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
time=[[int(s)for s in input().split()]for i in range(3)]
for t in time:
    t_in=3600*t[0]+60*t[1]+t[2]
    t_out=_in=3600*t[3]+60*t[4]+t[5]
    dur=t_out-t_in
    h=dur//3600
    dur%=3600
    m=dur//60
    dur%=60
    print(" ".join([str(e)for e in [h,m,dur]]))

Submission status: Accepted

Solution code:
def time():
    A = list(map(int,input().split()))
    shussha = A[:3]
    taisha = A[3:]
    sec = ((taisha[2] + 60) - shussha[2] ) % 60
    kurisagari_min = int(taisha[2] - shussha[2] < 0)
    min = ((taisha[1] - kurisagari_min + 60) - shussha[1])  % 60
    kurisagari_hour = int(taisha[1] - kurisagari_min - shussha[1] < 0)
    hour =  taisha[0] - kurisagari_hour - shussha[0]
    return (str(hour)+" "+str(min)+" "+str(sec))
A = time()
B = time()
C = time()
print(A)
print(B)
print(C)

Submission status: Accepted

Solution code:
from datetime import datetime as dt


def while_in_time(two_times):
    times = two_times.split()  # ???????????????

    in_time_str = ' '.join(times[:3])  # ??\????????????????????????
    out_time_str = ' '.join(times[3:])  # ???????????????????????????

    in_time = dt.strptime(in_time_str, '%H %M %S')   #??\??????????????????
    out_time = dt.strptime(out_time_str, '%H %M %S')

    while_time = out_time - in_time  # ?????????????????????????¨??????????

    seconds = while_time.seconds
    hour = seconds // 3600
    minute = seconds % 3600 // 60
    sec = seconds % 60
    str_while_time = '{} {} {}'.format(hour, minute, sec)

    return str_while_time


A_time = input()
B_time = input()
C_time = input()
print(while_in_time(A_time))
print(while_in_time(B_time))
print(while_in_time(C_time))

Submission status: Accepted

Solution code:
def time(inp):
  h1,m1,s1,h2,m2,s2 = inp
  s = s2 - s1
  if s < 0:
    s += 60
    m2 -= 1
  m = m2 - m1
  if m < 0:
    m += 60
    h2 -= 1
  h = h2 - h1
  print(h,m,s)
for i in range(3):
  time(tuple(map(int,input().split())))

Submission status: Accepted

Solution code:
import sys
for e in sys.stdin:
 a,b,c,d,e,f=map(int,e.split())
 t=(d-a)*3600+(e-b)*60+f-c
 print(t//3600,t//60%60,t%60)

Submission status: Accepted

Solution code:
# AOJ 0532: Time Card
# Python3 2018.6.30 bal4u

for i in range(3):
	h1, m1, s1, h2, m2, s2 = map(int, input().split())
	t = (3600*h2 + 60*m2 + s2) - (3600*h1 + 60*m1 + s1)
	print(t//3600, (t%3600)//60, t%60)

Submission status: Accepted

Solution code:
for i in range(3):
    h1,m1,s1,h2,m2,s2=map(int,raw_input().split())
    t=(h2-h1)*3600+(m2-m1)*60+(s2-s1)
    print t/3600,t%3600/60,t%3600%60

Submission status: Accepted

Solution code:
a,b=3600,60
for i in [1]*3:
	h,m,s,x,y,z=map(int,raw_input().split())
	s=(x-h)*a+(y-m)*b+(z-s)
	print s//a,s%a//b,s%b

Submission status: Accepted

Solution code:
b=60
a=b*b
for i in [1]*3:
	h,m,s,x,y,z=map(int,raw_input().split())
	s=(x-h)*a+(y-m)*b+z-s
	print s//a,s%a//b,s%b

Submission status: Accepted

Solution code:
def main():

    data = list(map(int, input().split()))

    a = data[:3]
    b = data[3:]
    ans = [0 for x in range(3)]

    t = b[2] - a[2]
    if t < 0:
        ans[2] = t + 60
        b[1] -= 1
    else:
        ans[2] = t


    t = b[1] - a[1]
    if t < 0:
        ans[1] = t + 60
        b[0] -= 1

    else:
        ans[1] = t

    ans[0] = b[0] - a[0]
    for a in ans[:-1]:
        print(a, end=' ')
    print(ans[-1])

if __name__ == '__main__':
    for a in range(3):
        main()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
for i in range(3):
    x=list(map(int,input().split()))
    x0=x[0]*3600+x[1]*60+x[2]
    x1=x[3]*3600+x[4]*60+x[5]
    
    h=(x1-x0)//3600
    m=((x1-x0)%3600)//60
    s=((x1-x0)%3600)%60
    
    print(h,m,s)

Submission status: Accepted

Solution code:
for i in range(3):
    L  =list(map(int,input().split()))
    L0 = L[0] * 60 * 60 + L[1] * 60 + L[2]
    L1 = L[3] * 60 * 60 + L[4] * 60 + L[5]
    h = (L1 - L0) // (60 * 60)
    m = ((L1 - L0) % (60 * 60)) // 60
    s = ((L1 - L0) % (60 * 60)) % 60
    print(h,m,s)

Submission status: Accepted

Solution code:
for _ in range(3):
	a = list(map(int, input().split()))
	wt = 3600*(a[3]-a[0])+60*(a[4]-a[1])+a[5]-a[2]
	print('{0} {1} {2}'.format(wt//3600, wt%3600//60, wt%3600%60))

Submission status: Accepted

Solution code:
for i in range(3) :
    h_s, m_s, s_s, h_e, m_e, s_e = map(int, input().split())
    x = h_e * 3600 + m_e * 60 + s_e - h_s * 3600 - m_s * 60 - s_s
    h_a = x // 3600
    m_a = x % 3600 // 60
    s_a = x % 3600 % 60
    print(h_a, m_a, s_a)

Submission status: Accepted

Solution code:
for t in range(3):
    intlist = input().split(" ")
    int_list = [int(a) for a in intlist]
    h = int_list[3] - int_list[0]
    m = int_list[4] - int_list[1]
    s = int_list[5] - int_list[2]
    if s < 0:
        m -= 1
        s += 60
    if m < 0:
        h -= 1
        m += 60
    print(str(h) + " " + str(m) + " " + str(s))

Submission status: Accepted

Solution code:
import sys
h1a,m1a,s1a,h2a,m2a,s2a=map(int,input().split())
h1b,m1b,s1b,h2b,m2b,s2b=map(int,input().split())
h1c,m1c,s1c,h2c,m2c,s2c=map(int,input().split())
if(s2a<s1a):
    sa=(60+s2a)-s1a
    m2a=m2a-1
else:
    sa=s2a-s1a
if(m2a<m1a):
    ma=(60+m2a)-m1a
    h2a=h2a-1
else:
    ma=m2a-m1a
ha=h2a-h1a
if(s2b<s1b):
    sb=(60+s2b)-s1b
    m2b=m2b-1
else:
    sb=s2b-s1b
if(m2b<m1b):
    mb=(60+m2b)-m1b
    h2b=h2b-1
else:
    mb=m2b-m1b
hb=h2b-h1b
if(s2c<s1c):
    sc=(60+s2c)-s1c
    m2c=m2c-1
else:
    sc=s2c-s1c
if(m2c<m1c):
    mc=(60+m2c)-m1c
    h2c=h2c-1
else:
    mc=m2c-m1c
hc=h2c-h1c
print(str(ha)+' '+str(ma)+' '+str(sa))
print(str(hb)+' '+str(mb)+' '+str(sb))
print(str(hc)+' '+str(mc)+' '+str(sc))

Submission status: Accepted

Solution code:
H_1,M_1,S_1,H_2,M_2,S_2=0,0,0,0,0,0
X=0
for i in range(3):
  H_1,M_1,S_1,H_2,M_2,S_2=map(int,input().split())
  X=-(H_1*3600+M_1*60+S_1-(H_2*3600+M_2*60+S_2))
  print(X//3600,(X//60)%60,X%60)

Submission status: Accepted

Solution code:
for _ in range(3):
    h1, m1, s1, h2, m2, s2 = map(int, input().split())
    t = h2*3600+m2*60+s2-h1*3600-m1*60-s1
    print(t//3600, (t%3600)//60, t%60)

Submission status: Accepted

Solution code:
AH,AM,AS,AH2,AM2,AS2=map(int,input().split())
BH,BM,BS,BH2,BM2,BS2=map(int,input().split())
CH,CM,CS,CH2,CM2,CS2=map(int,input().split())
A=AH2*3600+AM2*60+AS2-AH*3600-AM*60-AS
B=BH2*3600+BM2*60+BS2-BH*3600-BM*60-BS
C=CH2*3600+CM2*60+CS2-CH*3600-CM*60-CS
print(A//3600,A%3600//60,A%3600%60)
print(B//3600,B%3600//60,B%3600%60)
print(C//3600,C%3600//60,C%3600%60)

Submission status: Accepted

Solution code:
for i in range(3):
    A, B, C, D, E, F = map(int, input().split())

    t = 3600 * (D - A) + 60 * (E - B) + (F - C)
    h = t // 3600
    t %= 3600
    m = t // 60
    t %= 60
    s = t % 60
    print(h, m, t)

Submission status: Accepted

Solution code:
def sec(h,m,s):
	return 3600*h+60*m+s

def hms(sec):
	return f"{sec//3600} {(sec//60)%60} {sec%60}"

for i in range(3):
	h,m,s,H,M,S=map(int,input().split())
	print(hms(sec(H,M,S)-sec(h,m,s)))

Submission status: Accepted

Solution code:
import sys

arr = []
for line in sys.stdin:
    h1, m1, s1, h2, m2, s2 = map(int, line.split())
    
    a1 = h1 * 3600 + m1 * 60 + s1
    a2 = h2 * 3600 + m2 * 60 + s2
    
    a3 = a2 - a1
    
    h3 = int(a3 / 3600)
    a3 -= h3 * 3600
    m3 = int(a3 / 60)
    s3 = a3 - m3 * 60
    
    print(h3, m3, s3)

Submission status: Accepted

Solution code:
for i in range(3):
    l=list(map(int,input().split()))
    a=(l[3]-l[0])*3600+(l[4]-l[1])*60+l[5]-l[2]
    h,a=divmod(a,3600)
    m,s=divmod(a,60)
    print(h,m,s)

Submission status: Accepted

Solution code:
def inputtebul():
	lit=[]
	for unuse in range(1):
		lit=(list(map(int,input().split())))
	return lit
def jikan(a):
	sy=((a[0]*3600)+(a[1]*60)+a[2])
	ty=((a[3]*3600)+(a[4]*60)+a[5])
	zy=ty-sy
	h=int(zy/3600)
	m=int((zy-(3600*h))/60)
	s=int(zy-((3600*h)+(60*m)))
	n=(str(h)+' '+str(m)+' '+str(s))
	return(n)
A=inputtebul()
B=inputtebul()
C=inputtebul()
print(jikan(A))
print(jikan(B))
print(jikan(C))

Submission status: Accepted

Solution code:
import datetime
for i in range(3):
    h1,m1,s1,h2,m2,s2=map(int,input().split())
    t_c=datetime.datetime(2019,3,7,h1,m1,s1)
    t_b=datetime.datetime(2019,3,7,h2,m2,s2)
    t_a=str(t_b-t_c)
    ha,hb,hc=map(int,t_a.split(":"))
    print(ha,hb,hc)

Submission status: Accepted

Solution code:
for _ in range(3):
    time = list(map(int, input().split()))
    if time[2] > time[5]:
        time[5] += 60
        time[4] -= 1
    if time[1] > time[4]:
        time[4] += 60
        time[3] -= 1
    hour = time[3] - time[0]
    minute = time[4] - time[1]
    second = time[5] - time[2]
    print(hour, minute, second)

Submission status: Accepted

Solution code:
import sys
while 1:  
  try:
    h1,m1,s1,h2,m2,s2=map(int,input().split())
  except EOFError: break
  '''
  m1=input()
  s1=input()
  h2=input()
  m2=input()
  s2=input()
  '''

  s1=s2+60-s1  
  s2=s1%60
  s1=s1/60

  m1=m2+60-1-m1+s1
  m2=m1%60
  m1=m1/60

  h2=h2-h1-1+m1

#print("d d d"%(h,m,s))
  print('%d'%h2,'%d'%m2,'%d'%s2)

Submission status: Accepted

Solution code:
aList = raw_input().split(' ')
bList = raw_input().split(' ')
cList = raw_input().split(' ')
for i in range(6):
    aList[i] = int(aList[i])
for j in range(6):
    bList[j] = int(bList[j])
for k in range(6):
    cList[k] = int(cList[k])
aS = aList[3] * 3600 + aList[4] * 60 + aList[5] - aList[0] * 3600 - aList[1] * 60 - aList[2]
bS = bList[3] * 3600 + bList[4] * 60 + bList[5] - bList[0] * 3600 - bList[1] * 60 - bList[2]
cS = cList[3] * 3600 + cList[4] * 60 + cList[5] - cList[0] * 3600 - cList[1] * 60 - cList[2]
aHour = aS / 3600
aMinute = (aS - aHour * 3600) / 60
aSecond = aS - aHour * 3600 - aMinute * 60
bHour = bS / 3600
bMinute = (bS - bHour * 3600) / 60
bSecond = bS - bHour * 3600 - bMinute * 60
cHour = cS / 3600
cMinute = (cS - cHour * 3600) / 60
cSecond = cS - cHour * 3600 - cMinute * 60
print aHour, aMinute, aSecond
print bHour, bMinute, bSecond
print cHour, cMinute, cSecond

Submission status: Runtime Error

Solution code:
import datetime


def while_in_time(two_times):
    times = two_times.split()  # ???????????????

    in_time_str = ' '.join(times[:3])  # ??\????????????????????????
    out_time_str = ' '.join(times[3:])  # ???????????????????????????

    in_time = datetime.datetime.strptime(in_time_str, '%H %M %S')   #??\??????????????????
    out_time = datetime.datetime.strptime(out_time_str, '%H %M %S')

    while_time = out_time - in_time  # ?????????????????????????¨??????????
    str_while_time = while_time.datetime.strftime(while_time, '%H %M %S')

    return str_while_time


A_time = input()
B_time = input()
C_time = input()

print(while_in_time(A_time))
print(while_in_time(B_time))
print(while_in_time(C_time))

Submission status: Runtime Error

Solution code:
ef main():

    data = list(map(int, input().split()))
#     print(data)

    a = data[:3]
#     print(a)
    b = data[3:]
#     print(b)
    ans = [0 for x in range(3)]

    t = b[2] - a[2]
    if t < 0:
        ans[2] = t + 60
        b[1] -= 1
    else:
        ans[2] = t


    t = b[1] - a[1]
    if t < 0:
        ans[1] = t + 60
        b[0] -= 1

    else:
        ans[1] = t

    ans[0] = b[0] - a[0]
#     print(ans)
    for a in ans[:-1]:
        print(a, end=' ')
    print(ans[-1])

if __name__ == '__main__':
    for a in range(3):
        main()

Submission status: WA: Presentation Error

Solution code:
def time():
    A = list(map(int,input().split()))
    shussha = A[:3]
    taisha = A[3:]
    sec = ((taisha[2] + 60) - shussha[2] ) % 60
    kurisagari_min = int(taisha[2] - shussha[2] < 0)
    min = ((taisha[1] - kurisagari_min + 60) - shussha[1])  % 60
    kurisagari_hour = int(taisha[1] - kurisagari_min - shussha[1] < 0)
    hour =  taisha[0] - kurisagari_hour - shussha[0]
    return (str(hour)+" "+str(min)+" "+str(sec))
A = time()
B = time()
C = time()
print(A)
print(B)
print(C,end="")