a, b, d = map(int, input().split()) sum = a + b quotient = 1 mods = [] while quotient != 0: quotient = sum // d mods.append(str(sum%d)) sum = quotient mods.reverse() print("".join(mods))
a, b, D = [eval(i) for i in input().split()] n = a + b L = [] while n: L.insert(0, n % D) n //= D print(''.join([str(i) for i in L]))
import sys def dec2base(num, base): if num == 0: return dec2base(num/base, base) remain = num % base sys.stdout.write(str(remain)) try: while True: t = [int(i) for i in raw_input().split()] result = t[0] + t[1] dec2base(result, t[2]) except EOFError: pass人生苦短,我用Python
import sys def dec2base(num, base): if num == 0: return dec2base(num/base, base) remain = num % base sys.stdout.write(str(remain)) try: while True: t = [int(i) for i in raw_input().split()] result = t[0] + t[1] dec2base(result, t[2]) except EOFError: pass人生苦短,我用Python