結果

問題 No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
ユーザー roarisroaris
提出日時 2021-11-05 22:45:08
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 639 bytes
コンパイル時間 367 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 71,836 KB
最終ジャッジ日時 2023-08-06 10:44:01
合計ジャッジ時間 3,720 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,644 KB
testcase_01 AC 93 ms
71,592 KB
testcase_02 AC 93 ms
71,572 KB
testcase_03 AC 94 ms
71,676 KB
testcase_04 AC 93 ms
71,524 KB
testcase_05 AC 92 ms
71,768 KB
testcase_06 AC 91 ms
71,764 KB
testcase_07 AC 93 ms
71,580 KB
testcase_08 AC 91 ms
71,412 KB
testcase_09 AC 94 ms
71,436 KB
testcase_10 AC 95 ms
71,720 KB
testcase_11 AC 95 ms
71,756 KB
testcase_12 AC 93 ms
71,836 KB
testcase_13 AC 94 ms
71,440 KB
testcase_14 AC 94 ms
71,716 KB
testcase_15 AC 95 ms
71,680 KB
testcase_16 AC 94 ms
71,772 KB
testcase_17 AC 95 ms
71,836 KB
testcase_18 AC 94 ms
71,624 KB
testcase_19 AC 95 ms
71,436 KB
testcase_20 AC 93 ms
71,472 KB
testcase_21 AC 95 ms
71,828 KB
testcase_22 AC 95 ms
71,528 KB
testcase_23 AC 94 ms
71,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N = input()[:-1]
binary = []

for Ni in N:
    if Ni=='A':
        binary += [1, 0, 1, 0]
    elif Ni=='B':
        binary += [1, 0, 1, 1]
    elif Ni=='C':
        binary += [1, 1, 0, 0]
    elif Ni=='D':
        binary += [1, 1, 0, 1]
    elif Ni=='E':
        binary += [1, 1, 1, 0]
    elif Ni=='F':
        binary += [1, 1, 1, 1]

binary = [0]*((3-len(binary)%3)%3)+binary
cnt = defaultdict(int)

for i in range(0, len(binary), 3):
    v = 4*binary[i]+2*binary[i+1]+binary[i+2]
    cnt[v] += 1

M = max(cnt.values())
ans = [v for v in range(8) if cnt[v]==M]
print(*ans)
0