PAT(Advanced Level) Practice(with python)——1058 A+B in Hogwarts

PAT(Advanced Level) Practice(with python)——1058 A+B in Hogwarts_第1张图片

Code

A,B = map(str,input().split())
g1,s1,k1 = A.split('.')
g2,s2,k2 = B.split('.')
g = int(g1)+int(g2)
s = int(s1)+int(s2)
k = int(k1)+int(k2)
if k>=29:
    s+=1
    k%=29
if s>=17:
    g+=1
    s%=17
print(str(g)+'.'+str(s)+'.'+str(k))

PAT(Advanced Level) Practice(with python)——1058 A+B in Hogwarts_第2张图片

你可能感兴趣的:(PAT,python,数据库,算法)