Submission #12498346


Source Code Expand

Copy
s = input()[::-1]
v = 0
mods = [ 0 for i in range(2019) ]
mods[0] = 1
d = 1

for c in s:
    v += int(c) * d
    v %= 2019
    d *= 10
    d %= 2019
    mods[v] += 1

ans = 0
for n in mods:
    ans += (n * (n - 1)) // 2

print(ans)

Submission Info

Submission Time
Task D - Multiple of 2019
User shinobe
Language Python (3.8.2)
Score 400
Code Size 248 Byte
Status
Exec Time 113 ms
Memory 9352 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 01.txt, 02.txt, 03.txt
All 400 / 400 01.txt, 02.txt, 03.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt
Case Name Status Exec Time Memory
01.txt 19 ms 9040 KB
02.txt 17 ms 8960 KB
03.txt 17 ms 9164 KB
11.txt 110 ms 9064 KB
12.txt 81 ms 9204 KB
13.txt 18 ms 8888 KB
14.txt 109 ms 9352 KB
15.txt 99 ms 9064 KB
16.txt 32 ms 8984 KB
17.txt 113 ms 9200 KB
18.txt 18 ms 9036 KB