結果

問題 No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
ユーザー koba-e964koba-e964
提出日時 2021-11-05 21:26:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 551 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 82,584 KB
実行使用メモリ 53,756 KB
最終ジャッジ日時 2024-04-24 05:12:34
合計ジャッジ時間 1,914 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,472 KB
testcase_01 AC 33 ms
52,620 KB
testcase_02 AC 33 ms
52,140 KB
testcase_03 AC 32 ms
52,472 KB
testcase_04 AC 37 ms
52,912 KB
testcase_05 AC 33 ms
52,948 KB
testcase_06 AC 34 ms
52,008 KB
testcase_07 AC 33 ms
52,188 KB
testcase_08 AC 33 ms
52,896 KB
testcase_09 AC 35 ms
52,940 KB
testcase_10 AC 33 ms
52,272 KB
testcase_11 AC 33 ms
53,360 KB
testcase_12 AC 33 ms
52,384 KB
testcase_13 AC 33 ms
53,012 KB
testcase_14 AC 32 ms
52,316 KB
testcase_15 AC 32 ms
52,880 KB
testcase_16 AC 32 ms
52,208 KB
testcase_17 AC 33 ms
53,672 KB
testcase_18 AC 33 ms
52,468 KB
testcase_19 AC 32 ms
52,288 KB
testcase_20 AC 33 ms
52,072 KB
testcase_21 AC 32 ms
53,360 KB
testcase_22 AC 32 ms
52,064 KB
testcase_23 AC 34 ms
53,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

s = input()
while len(s) % 3 != 0:
    s = '0' + s
f = [0] * 8
z = True
for i in range(len(s) // 3):
    x = 0
    for j in range(3 * i, 3 * i + 3):
        x = 16 * x + '0123456789ABCDEF'.index(s[j])
    c = 512
    for _ in range(4):
        if x // c != 0 or not z:
            f[x // c] += 1
            if x // c != 0:
                z = False
        x %= c
        c //= 8

ma = 0
for i in range(8):
    ma = max(ma, f[i])

v = []
for i in range(8):
    if f[i] == ma:
        v.append(i)

print(' '.join(map(str, v)))
0