結果

問題 No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
ユーザー k_o_pasturek_o_pasture
提出日時 2021-11-05 22:06:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,015 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 54,400 KB
最終ジャッジ日時 2024-04-24 05:53:35
合計ジャッジ時間 1,917 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
54,144 KB
testcase_01 AC 41 ms
54,016 KB
testcase_02 AC 41 ms
53,504 KB
testcase_03 AC 42 ms
53,632 KB
testcase_04 AC 44 ms
53,760 KB
testcase_05 AC 43 ms
54,016 KB
testcase_06 AC 41 ms
53,888 KB
testcase_07 WA -
testcase_08 AC 42 ms
54,016 KB
testcase_09 AC 41 ms
54,016 KB
testcase_10 AC 45 ms
54,144 KB
testcase_11 AC 40 ms
53,760 KB
testcase_12 AC 41 ms
54,016 KB
testcase_13 AC 42 ms
53,888 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 42 ms
54,016 KB
testcase_22 AC 41 ms
53,760 KB
testcase_23 AC 41 ms
54,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = list(input())
tmp = []
A = '1010'
B = '1011'
C = '1100'
D = '1101'
E = '1110'
F = '1111'
for s in S[::-1]:
	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)))

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(max_k_list))
0