add shebang to run.py and complete 10986.py 11659.py 11660.py
This commit is contained in:
1
run.py
1
run.py
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|||||||
17
zeta_python/completed/10986.py
Normal file
17
zeta_python/completed/10986.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import sys
|
||||||
|
import math
|
||||||
|
|
||||||
|
input = sys.stdin.readline
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
N, M = map(int, input().split())
|
||||||
|
A = list(map(int, input().split()))
|
||||||
|
S = [(0, 0)]
|
||||||
|
C = [0] * 1001
|
||||||
|
C[0] = 1
|
||||||
|
for i in range(N):
|
||||||
|
s = ((S[-1][0] + A[i]) % M, i + 1)
|
||||||
|
S.append(s)
|
||||||
|
C[s[0]] += 1
|
||||||
|
|
||||||
|
print(sum([math.comb(c, 2) for c in C]))
|
||||||
13
zeta_python/completed/11659.py
Normal file
13
zeta_python/completed/11659.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
input = sys.stdin.readline
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
N, M = map(int, input().split())
|
||||||
|
A = list(map(int, input().split()))
|
||||||
|
S = [0]
|
||||||
|
for i in range(N):
|
||||||
|
S.append(S[-1] + A[i])
|
||||||
|
for _ in range(M):
|
||||||
|
i, j = map(int, input().split())
|
||||||
|
print(S[j] - S[i - 1])
|
||||||
16
zeta_python/completed/11660.py
Normal file
16
zeta_python/completed/11660.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
input = sys.stdin.readline
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
N, M = map(int, input().split())
|
||||||
|
A = [list(map(int, input().split())) for _ in range(N)]
|
||||||
|
|
||||||
|
S = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
|
||||||
|
for i in range(N):
|
||||||
|
for j in range(N):
|
||||||
|
S[i + 1][j + 1] = S[i][j + 1] + S[i + 1][j] - S[i][j] + A[i][j]
|
||||||
|
|
||||||
|
for _ in range(M):
|
||||||
|
x1, y1, x2, y2 = map(int, input().split())
|
||||||
|
print(S[x2][y2] - S[x2][y1 - 1] - S[x1 - 1][y2] + S[x1 - 1][y1 - 1])
|
||||||
Reference in New Issue
Block a user