結果

問題 No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
ユーザー SidewaysOwlSidewaysOwl
提出日時 2021-11-05 21:30:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 613 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 82,468 KB
実行使用メモリ 57,096 KB
最終ジャッジ日時 2024-04-24 05:17:18
合計ジャッジ時間 1,717 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
55,260 KB
testcase_01 AC 40 ms
54,780 KB
testcase_02 AC 39 ms
54,728 KB
testcase_03 AC 38 ms
54,636 KB
testcase_04 AC 37 ms
54,464 KB
testcase_05 AC 42 ms
54,508 KB
testcase_06 AC 36 ms
54,260 KB
testcase_07 AC 36 ms
54,096 KB
testcase_08 AC 39 ms
57,096 KB
testcase_09 AC 40 ms
56,044 KB
testcase_10 AC 43 ms
56,684 KB
testcase_11 AC 38 ms
54,668 KB
testcase_12 AC 38 ms
56,440 KB
testcase_13 AC 38 ms
55,132 KB
testcase_14 AC 38 ms
53,792 KB
testcase_15 AC 36 ms
54,456 KB
testcase_16 AC 37 ms
54,772 KB
testcase_17 AC 37 ms
55,432 KB
testcase_18 AC 37 ms
54,596 KB
testcase_19 AC 36 ms
54,992 KB
testcase_20 AC 38 ms
53,848 KB
testcase_21 AC 38 ms
54,336 KB
testcase_22 AC 36 ms
53,492 KB
testcase_23 AC 37 ms
54,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = input()
l = ["A","B","C","D","E","F"]
# m進数を10進数に変換
def m_to_ten(n,m):
    res = 0
    cnt = 0
    for i in range(len(n)):
        res += m ** cnt * (l.index(n[-(i+1)])+10)
        cnt += 1
    return res
# 10進数をm進数に変換
def ten_to_m(n,m):
    res = 0
    cnt = 0
    while n > 0:
        res += (n % m) * 10 ** cnt
        n = n // m
        cnt += 1
    return res
ans = str(ten_to_m( m_to_ten(n,16),8))
from collections import Counter
c = Counter(ans)
max_ = max(c.values())
ans_l = []
for k in c.keys():
    if c[k] == max_:
        ans_l.append(k)
ans_l.sort()
print(*ans_l)
0