QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#153694#7042. So EasyPetroTarnavskyi#Compile Error//C++17457b2023-08-30 19:08:202023-08-30 19:08:21

Judging History

你现在查看的是最新测评结果

  • [2023-08-30 19:08:21]
  • 评测
  • [2023-08-30 19:08:20]
  • 提交

answer

x, y, z = input().split()
x = int(x)
y = int(y)
n = 0
for c in z:
	d = ord(c) - ord('0') if '0' <= c <= '9' else  ord(c) - ord('A') + 10 if 'A' <= c <= 'Z' else ord(c) - ord('a') + 36
	n = x * n + d
s = ""
if n == 0:
	print(0)
	exit(0)
while n != 0:
	d = n % y
	if d < 10:
		s += str(d)
	elif d < 36:
		s += chr(ord('A') + 10)
	else:
		s += chr(ord('a') + 36)
	n //= y
for i in range(len(s) - 1, -1, -1):
	print(s[i], end='')
print()

Details

answer.code:22:25: error: empty character constant
   22 |         print(s[i], end='')
      |                         ^~
answer.code:1:1: error: ‘x’ does not name a type
    1 | x, y, z = input().split()
      | ^