AtCoder Beginner Contest 007

Submission #3731736

Source codeソースコード

# [0, n]
def count(n):
    cnt = 0
    n = list(str(n))
    n.reverse()
    for i, m in enumerate(n):
        m = int(m)
        if m < 4:
            cnt += m * pow10[i]
        elif m < 9:
            cnt += (m-1) * pow10[i] + 10**i
        else:
            cnt += 8 * pow10[i] + 2 * 10**i
    return cnt

a, b = [int(s) for s in input().rstrip().split()]
# [0, 10^0] ~ [0, 10^18]
pow10 = [0]
for i in range(1, 19):
    pow10.append(pow10[-1] * 8 + 10**(i-1) * 2)
    
print(count(b) - count(a-1))

Submission

Task問題 D - 禁止された数字
User nameユーザ名 kirikirijin
Created time投稿日時
Language言語 Python3 (3.4.3)
Status状態 WA
Score得点 0
Source lengthソースコード長 521 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - subtask0_sample01.txt,subtask0_sample02.txt,subtask0_sample03.txt,subtask0_sample04.txt
Subtask1 0 / 30 subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask0_sample01.txt,subtask0_sample02.txt,subtask0_sample03.txt
Subtask2 0 / 70 subtask0_sample01.txt,subtask0_sample02.txt,subtask0_sample03.txt,subtask0_sample04.txt,subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask2_01.txt,subtask2_02.txt,subtask2_03.txt,subtask2_04.txt,subtask2_05.txt,subtask2_06.txt,subtask2_07.txt,subtask2_08.txt,subtask2_09.txt,subtask2_10.txt,subtask2_11.txt,subtask2_12.txt,subtask2_13.txt,subtask2_14.txt,subtask2_15.txt,subtask2_16.txt,subtask2_17.txt,subtask2_18.txt,subtask2_19.txt,subtask2_20.txt,subtask2_21.txt,subtask2_22.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
subtask0_sample01.txt AC 17 ms 3064 KB
subtask0_sample02.txt AC 17 ms 3064 KB
subtask0_sample03.txt AC 17 ms 3064 KB
subtask0_sample04.txt AC 18 ms 3064 KB
subtask1_01.txt AC 18 ms 3064 KB
subtask1_02.txt WA
subtask1_03.txt AC 17 ms 3060 KB
subtask1_04.txt WA
subtask1_05.txt WA
subtask1_06.txt WA
subtask1_07.txt WA
subtask1_08.txt WA
subtask1_09.txt WA
subtask1_10.txt AC 19 ms 3064 KB
subtask1_11.txt WA
subtask1_12.txt WA
subtask1_13.txt AC 17 ms 3064 KB
subtask2_01.txt WA
subtask2_02.txt AC 17 ms 3060 KB
subtask2_03.txt WA
subtask2_04.txt WA
subtask2_05.txt WA
subtask2_06.txt WA
subtask2_07.txt WA
subtask2_08.txt WA
subtask2_09.txt WA
subtask2_10.txt WA
subtask2_11.txt WA
subtask2_12.txt WA
subtask2_13.txt WA
subtask2_14.txt WA
subtask2_15.txt WA
subtask2_16.txt WA
subtask2_17.txt WA
subtask2_18.txt WA
subtask2_19.txt WA
subtask2_20.txt WA
subtask2_21.txt WA
subtask2_22.txt WA