Skip to content

Commit 0dfe37b

Browse files
author
IsHYuhi
committed
ABC131-134, 176
1 parent d6a26e7 commit 0dfe37b

File tree

14 files changed

+114
-6
lines changed

14 files changed

+114
-6
lines changed

ABC/ABC131/D.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
n = int(input())
2+
ab = []
3+
now = 0
4+
for i in range(n):
5+
_a, _b = map(int, input().split())
6+
ab.append([_a, _b])
7+
8+
ab.sort(key=lambda x: x[1])
9+
for a, b in ab:
10+
now += a
11+
if now>b:
12+
print('No')
13+
exit()
14+
print('Yes')

ABC/ABC132/A.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from collections import Counter
2+
S = list(input())
3+
S = Counter(S)
4+
5+
if len(S)==2:
6+
for i, j in S.items():
7+
if j != 2:
8+
print('No')
9+
exit()
10+
11+
print('Yes')
12+
else:
13+
print('No')

ABC/ABC132/B.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
n = int(input())
2+
p = list(map(int, input().split()))
3+
4+
ans = 0
5+
for i in range(1, n-1):
6+
if (p[i] != max(p[i-1], p[i], p[i+1])) and (p[i] != min(p[i-1], p[i], p[i+1])):
7+
ans += 1
8+
print(ans)

ABC/ABC132/C.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
n = int(input())
2+
d = list(map(int, input().split()))
3+
d.sort()
4+
print(d[n//2]-d[n//2-1])

ABC/ABC133/A.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
n, a, b = map(int, input().split())
2+
3+
print(min(n*a, b))

ABC/ABC133/B.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import math
2+
from itertools import combinations
3+
n, d = map(int, input().split())
4+
5+
def is_distance_int(y, z):
6+
ans = 0
7+
for i, j in zip(y, z):
8+
ans += (i-j)**2
9+
for k in range(1, ans+1):
10+
if k**2 == ans:
11+
return 1
12+
return 0
13+
14+
x = []
15+
for i in range(n):
16+
x.append(list(map(int, input().split())))
17+
18+
c = [i for i in range(n)]
19+
c = combinations(c, 2)
20+
21+
ans = 0
22+
for i, j in c:
23+
ans += is_distance_int(x[i], x[j])
24+
25+
print(ans)

ABC/ABC133/C.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
l, r = map(int, input().split())
2+
ans = float('inf')
3+
for i in range(l, r):
4+
for j in range(i+1, r+1):
5+
if (i*j)%2019 == 0:
6+
print(0)
7+
exit()
8+
ans = min(ans, (i*j)%2019)
9+
print(ans)

ABC/ABC134/A.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
r = int(input())
2+
print(3*(r**2))

ABC/ABC134/B.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import math
2+
n, d = map(int, input().split())
3+
print(math.ceil(n/(2*d+1)))

ABC/ABC134/C.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
n = int(input())
2+
a = [int(input()) for i in range(n)]
3+
b = sorted(a, reverse=True)
4+
for i in a:
5+
if i == b[0]:
6+
print(b[1])
7+
else:
8+
print(b[0])

ABC/ABC176/A.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import math
2+
n, x, t = map(int, input().split())
3+
print(math.ceil(n/x)*t)

ABC/ABC176/B.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
n = map(int, list(input()))
2+
if sum(n)%9 == 0:
3+
print('Yes')
4+
else:
5+
print('No')
6+

ABC/ABC176/C.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
n = int(input())
2+
a = list(map(int, input().split()))
3+
m = a[0]
4+
ans = 0
5+
for i in a:
6+
if m > i:
7+
ans += m - i
8+
else:
9+
m = i
10+
print(ans)

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ AtCoderの問題をpython3で解いたものになります。AC確認は行っ
9090
[ABC128](ABC/ABC128)|[✓](ABC/ABC128/A.py)|[✓](ABC/ABC128/B.py)||||||[ABC168](ABC/ABC168)|[✓](ABC/ABC168/A.py)|[✓](ABC/ABC168/B.py)|[✓](ABC/ABC168/C.py)||||
9191
[ABC129](ABC/ABC129)|[✓](ABC/ABC129/A.py)|[✓](ABC/ABC129/B.py)|[✓](ABC/ABC129/C.py)|||||ABC169|||||||
9292
[ABC130](ABC/ABC130)|[✓](ABC/ABC130/A.py)|[✓](ABC/ABC130/B.py)|[✓](ABC/ABC130/C.py)|||||ABC170|||||||
93-
|ABC131||||||||[ABC171](ABC/ABC171)|[✓](ABC/ABC171/A.py)|[✓](ABC/ABC171/B.py)|[✓](ABC/ABC171/C.py)|[✓](ABC/ABC171/D.py)|||
94-
|ABC132||||||||[ABC172](ABC/ABC172)|[✓](ABC/ABC172/A.py)|[✓](ABC/ABC172/B.py)|||||
95-
|ABC133||||||||[ABC173](ABC/ABC173)|[✓](ABC/ABC173/A.py)|[✓](ABC/ABC173/B.py)|[✓](ABC/ABC173/C.py)|[✓](ABC/ABC173/D.py)|||
96-
|ABC134|||||||
97-
|ABC135|||||||
98-
|ABC136|||||||
93+
|[ABC131](ABC/ABC131)|[✓](ABC/ABC131/A.py)|[✓](ABC/ABC131/B.py)|[✓](ABC/ABC131/C.py)|[✓](ABC/ABC131/D.py)||||[ABC171](ABC/ABC171)|[✓](ABC/ABC171/A.py)|[✓](ABC/ABC171/B.py)|[✓](ABC/ABC171/C.py)|[✓](ABC/ABC171/D.py)|||
94+
|[ABC132](ABC/ABC132)|[✓](ABC/ABC132/A.py)|[✓](ABC/ABC132/B.py)|[✓](ABC/ABC132/C.py)|||||[ABC172](ABC/ABC172)|[✓](ABC/ABC172/A.py)|[✓](ABC/ABC172/B.py)|||||
95+
|[ABC133](ABC/ABC133)|[✓](ABC/ABC133/A.py)|[✓](ABC/ABC133/B.py)|[✓](ABC/ABC133/C.py)|||||[ABC173](ABC/ABC173)|[✓](ABC/ABC173/A.py)|[✓](ABC/ABC173/B.py)|[✓](ABC/ABC173/C.py)|[✓](ABC/ABC173/D.py)|||
96+
|[ABC134](ABC/ABC134)|[✓](ABC/ABC134/A.py)|[✓](ABC/ABC134/B.py)|[✓](ABC/ABC134/C.py)|||||ABC174|||||||
97+
|ABC135||||||||ABC175|||||||
98+
|ABC136||||||||[ABC176](ABC/ABC176)|[✓](ABC/ABC176/A.py)|[✓](ABC/ABC176/B.py)|[✓](ABC/ABC176/C.py)||||
9999
|ABC137|||||||
100100
|ABC138|||||||
101101
|ABC139|||||||

0 commit comments

Comments
 (0)