結果

問題 No.1185 完全な3の倍数
ユーザー 萩3萩3
提出日時 2021-05-03 01:15:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 886 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 86,760 KB
実行使用メモリ 71,536 KB
最終ジャッジ日時 2023-09-28 15:46:50
合計ジャッジ時間 6,338 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 78 ms
71,436 KB
testcase_02 AC 78 ms
71,272 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 79 ms
71,268 KB
testcase_09 AC 77 ms
71,524 KB
testcase_10 AC 77 ms
71,520 KB
testcase_11 AC 79 ms
71,316 KB
testcase_12 AC 76 ms
71,252 KB
testcase_13 AC 78 ms
71,332 KB
testcase_14 AC 77 ms
71,272 KB
testcase_15 AC 79 ms
71,236 KB
testcase_16 AC 78 ms
71,496 KB
testcase_17 AC 78 ms
71,228 KB
testcase_18 AC 78 ms
71,032 KB
testcase_19 AC 78 ms
71,264 KB
testcase_20 AC 78 ms
71,288 KB
testcase_21 AC 76 ms
71,284 KB
testcase_22 WA -
testcase_23 AC 75 ms
71,396 KB
testcase_24 AC 75 ms
71,428 KB
testcase_25 AC 76 ms
71,160 KB
testcase_26 AC 77 ms
71,376 KB
testcase_27 AC 75 ms
71,188 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 78 ms
71,296 KB
testcase_31 AC 74 ms
71,260 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 76 ms
71,340 KB
testcase_35 WA -
testcase_36 AC 77 ms
71,272 KB
testcase_37 AC 77 ms
71,520 KB
testcase_38 AC 79 ms
71,508 KB
testcase_39 AC 78 ms
71,276 KB
testcase_40 AC 78 ms
71,244 KB
testcase_41 AC 75 ms
71,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import sys

def resolve():
    nstr = input()
    length = len(nstr)
    n = int(nstr)

    if length == 2:
        print(n//3-3)
        return

    result = 30
    
    if length - 3 > 0:
        result += 16*(4**(length-3)-1)

    head = int(nstr[0])
    if head < 3:
        print(result)
        return
    elif head == 3:
        pass
    elif head < 6:
        result += 4**(length-1)
        print(result)
        return
    elif head == 6:
        result += 4**(length-1)
    elif head < 9:
        result += 2 * 4**(length-1)
        print(result)
        return
    else:
        result += 2 * 4**(length-1)

    tmp = 1
    for c in nstr[1:]:
        if int(c) < 3:
            continue
        elif int(c) < 6:
            tmp *= 2
        elif int(c) < 9:
            tmp *= 3
        else:
            tmp *= 4

    result += tmp
    print(result)

resolve()
0