Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import json
from sys import stdin
name = "scoring.json"
data = []
with open(name, "r", encoding="utf-8") as js:
data = json.load(js)
testcnt = 0
for elem in data:
testcnt += len(elem["tests"])
c = 0
packc = 0
pointsum = 0
d = data[packc]
points = d["points"]
tests = d["tests"]
for line in stdin:
answer = line.rstrip("\n")
if c < len(tests):
if tests[c]["pattern"] == answer:
pointsum += int(points / len(tests))
c += 1
else:
packc += 1
d = data[packc]
points = d["points"]
tests = d["tests"]
c = 0
if c < len(tests):
if tests[c]["pattern"] == answer:
pointsum += int(points / len(tests))
c += 1
print(pointsum)