結果
| 問題 |
No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
|
| コンテスト | |
| ユーザー |
k_o_pasture
|
| 提出日時 | 2021-11-05 22:17:40 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 1,031 bytes |
| コンパイル時間 | 265 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-11-06 13:11:18 |
| 合計ジャッジ時間 | 2,195 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 |
ソースコード
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))))
k_o_pasture