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 AC
Exec Time 113 ms
Memory 9352 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 11
Set Name Test Cases
Sample 01.txt, 02.txt, 03.txt
All 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 AC 19 ms 9040 KB
02.txt AC 17 ms 8960 KB
03.txt AC 17 ms 9164 KB
11.txt AC 110 ms 9064 KB
12.txt AC 81 ms 9204 KB
13.txt AC 18 ms 8888 KB
14.txt AC 109 ms 9352 KB
15.txt AC 99 ms 9064 KB
16.txt AC 32 ms 8984 KB
17.txt AC 113 ms 9200 KB
18.txt AC 18 ms 9036 KB