由案例手动模拟一下结果是怎么推出来的,然后再用代码实现即可
写法一:
s1,s2 = input().split()
a1,b1,c1 = map(int,s1.split('.'))
a2,b2,c2 = map(int,s2.split('.'))
Galleon = a1 + a2
Sickle = b1 + b2
Knut = c1 + c2
if Knut >= 29:
Knut -=29
Sickle += 1
if Sickle >= 17:
Sickle -= 17
Galleon += 1
print("{}.{}.{}".format(Galleon,Sickle,Knut))
写法二:
s1,s2 = input().split()
a1,b1,c1 = map(int,s1.split('.'))
a2,b2,c2 = map(int,s2.split('.'))
Galleon = a1 + a2
Sickle = b1 + b2
Knut = c1 + c2
Sickle += Knut // 29
Knut %= 29
Galleon += Sickle // 17
Sickle %= 17
print("{}.{}.{}".format(Galleon,Sickle,Knut))