結果

問題 No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
ユーザー k_o_pasturek_o_pasture
提出日時 2021-11-05 22:17:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 1,031 bytes
コンパイル時間 443 ms
コンパイル使用メモリ 10,888 KB
実行使用メモリ 8,784 KB
最終ジャッジ日時 2023-08-06 10:10:37
合計ジャッジ時間 1,590 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,644 KB
testcase_01 AC 19 ms
8,588 KB
testcase_02 AC 19 ms
8,524 KB
testcase_03 AC 19 ms
8,600 KB
testcase_04 AC 19 ms
8,664 KB
testcase_05 AC 18 ms
8,640 KB
testcase_06 AC 18 ms
8,668 KB
testcase_07 AC 18 ms
8,636 KB
testcase_08 AC 19 ms
8,784 KB
testcase_09 AC 18 ms
8,720 KB
testcase_10 AC 19 ms
8,548 KB
testcase_11 AC 19 ms
8,708 KB
testcase_12 AC 20 ms
8,664 KB
testcase_13 AC 19 ms
8,712 KB
testcase_14 AC 18 ms
8,580 KB
testcase_15 AC 19 ms
8,588 KB
testcase_16 AC 19 ms
8,648 KB
testcase_17 AC 19 ms
8,648 KB
testcase_18 AC 19 ms
8,692 KB
testcase_19 AC 19 ms
8,528 KB
testcase_20 AC 18 ms
8,656 KB
testcase_21 AC 18 ms
8,692 KB
testcase_22 AC 18 ms
8,756 KB
testcase_23 AC 19 ms
8,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = list(input())
tmp = []
A = '1010'
B = '1011'
C = '1100'
D = '1101'
E = '1110'
F = '1111'
for s in S:
	if s == 'A':
		tmp.append(A)
	elif s == 'B':
		tmp.append(B)	
	elif s == 'C':
		tmp.append(C)	
	elif s == 'D':
		tmp.append(D)	
	elif s == 'E':
		tmp.append(E)	
	elif s == 'F':
		tmp.append(F)	
tmp = ''.join(tmp)
if len(tmp)%3 == 1:
	tmp = '00' + tmp
elif len(tmp)%3 == 2:
	tmp = '0' + tmp

vec = [tmp[i: i+3] for i in range(0, len(tmp), 3)]
# print(tmp)
# print(vec)

ans = []
for v in vec:
	if v == '000':
		ans.append('0')
	elif v == '001':
		ans.append('1')
	elif v == '010':
		ans.append('2')
	elif v == '011':
		ans.append('3')
	elif v == '100':
		ans.append('4')
	elif v == '101':
		ans.append('5')
	elif v == '110':
		ans.append('6')
	elif v == '111':
		ans.append('7')
ans = str(int(''.join(ans)))
# print(ans)

from collections import defaultdict
d = defaultdict(int)

for a in ans:
    d[a] += 1

# print(d)
max_k_list = [kv[0] for kv in d.items() if kv[1] == max(d.values())]
print((' '.join(sorted(max_k_list))))
0