输入在1行中分别给出P和A,格式为“Galleon.Sickle.Knut”,其间用1个空格分隔。这里Galleon是[0, 107]]区间内的整数,Sickle是[0,
17)区间内的整数,Knut是[0, 29)区间内的整数。
在一行中用与输入同样的格式输出哈利应该被找的零钱。如果他没带够钱,那么输出的应该是负数。
10.16.27 14.1.28
3.2.1
A, B = 17, 29
a, b = [[eval(j) for j in i.split('.')] for i in input().split()]
a, b = a[0] * A * B + a[1] * B + a[2], b[0] * A * B + b[1] * B + b[2]
c = b - a if b - a >= 0 else a - b
d = c % B
c //= B
e = c % A
c //= A
if b - a < 0: print('-', end = '')
print('.'.join((str(i) for i in (c, e, d)))) P,A = input().split()
lP=P.split('.')
p=''
a=''
for i in lP:
if len(i)<2:
i='0'+i
p+=i
lA=A.split('.')
for j in lA:
if len(j)<2:
j='0'+j
a+=j
a=int(a)
p=int(p)
if p>a:
temp=A
A=P
P=temp
lsP=P.split('.')
lsP=list(map(int,lsP))
lsA=A.split('.')
lsA=list(map(int,lsA))
if lsP[2]<lsA[2]:
k=lsA[2]-lsP[2]
else:
k=lsA[2]+29-lsP[2]
lsA[1]=lsA[1]-1
if lsP[1]<lsA[1]:
s=lsA[1]-lsP[1]
else:
s=lsA[1]+17-lsP[1]
lsA[0]=lsA[0]-1
g=lsA[0]-lsP[0]
if p>a:
print('-{}.{}.{}'.format(g,s,k))
else:
print('{}.{}.{}'.format(g,s,k))
def TransKnut(s):a = [int(i) fori in s.split('.')]knut = (a[0] * 17+ a[1]) * 29+ a[2]returnknutdef TransGalleon(a):sickle,knut = divmod(a,29)gallen,sickle = divmod(sickle,17)returnstr(gallen)+'.'+str(sickle)+'.'+str(knut)need,give = input().split()needK,giveK = TransKnut(need),TransKnut(give)ifgiveK >= needK:print(TransGalleon(giveK - needK))else:print('-'+ TransGalleon(needK - giveK))
def jisuan(a,b): a1,a2,a3 = map(int, a.split(".")) b1,b2,b3 = map(int, b.split(".")) c3 = b3 - a3 c2 = b2 - a2 c1 = b1 - a1 if c3<0: c3 = c3 + 29 c2 = c2 -1 if c2 < 0: c2 = c2 + 17 c1 = c1 -1 return c1,c2,c3 a,b = map(str,input().split(" ")) c1,c2,c3 = jisuan(a,b) if str(c1)[0] == "-": c1, c2, c3 = jisuan(b, a) c1 = -c1 print("%d.%d.%d"%(c1,c2,c3))
try:
while True:
string = input().split()
pay = list(map(int,string[0].split('.')))
cost = list(map(int,string[1].split('.')))
payNum = (pay[0]*17+pay[1])*29+pay[2]
costNum = (cost[0]*17+cost[1])*29+cost[2]
remaining = costNum-payNum
if remaining<0:
sign = "-"
remaining = -remaining
else:
sign = ""
result = [0,0,0]
result[2] = remaining%29
result[0],result[1] = divmod((remaining//29),17)
print(sign+".".join(map(str,result)))
except Exception:
pass
P, A = raw_input().split(' ')
P_split = P.split('.')
A_split = A.split('.')
flag = False
result = ['', '', '']
a = [2, 1, 0]
for i in range(3):
P_split[i] = int(P_split[i])
A_split[i] = int(A_split[i])
for i in range(3):
if A_split[i] > P_split[i]:
break
elif A_split[i] == P_split[i]:
continue
elif A_split[i] < P_split[i]:
flag = True
break
if flag:
for i in a:
if P_split[i] < A_split[i]:
if i == 2:
P_split[i] += 29
elif i == 1:
P_split[i] += 17
if i != 0:
P_split[i - 1] -= 1
result[i] = str(P_split[i] - A_split[i])
else:
result[i] = str(P_split[i] - A_split[i])
print ('-'+'.'.join(result))
else:
for i in a:
if A_split[i] < P_split[i]:
if i == 2:
A_split[i] += 29
elif i == 1:
A_split[i] += 17
if i != 0:
A_split[i - 1] -= 1
result[i] = str(A_split[i] - P_split[i])
else:
result[i] = str(A_split[i] - P_split[i])
print '.'.join(result)