Skip to content

Commit 042970d

Browse files
author
IsHYuhi
committed
ABC42-50
1 parent 6e5e67d commit 042970d

File tree

19 files changed

+150
-0
lines changed

19 files changed

+150
-0
lines changed

ABC/ABC042/A.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from collections import Counter
2+
a = list(map(int, input().split()))
3+
4+
a = Counter(a)
5+
6+
if a.get(7) and a.get(5):
7+
if a[7]==1 and a[5]==2:
8+
print('YES')
9+
exit()
10+
print('NO')
11+

ABC/ABC042/B.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
n, l = map(int, input().split())
2+
s = [input() for _ in range(n)]
3+
s.sort()
4+
ans = ''.join(s)
5+
print(ans)

ABC/ABC043/A.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print(sum([i for i in range(1, int(input())+1)]))

ABC/ABC043/B.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
s = input()
2+
ans = []
3+
4+
for i in s:
5+
if i=='0':
6+
ans.append('0')
7+
elif i=='1':
8+
ans.append('1')
9+
elif i=='B' and ans:
10+
ans.pop()
11+
print(''.join(ans))

ABC/ABC043/C.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import numpy as np
2+
n = int(input())
3+
a = np.asarray(list(map(int, input().split())))
4+
m = float('inf')
5+
6+
for i in range(-100, 101):
7+
m = min(np.sum((a-i)**2), m)
8+
print(m)

ABC/ABC044/A.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
n = int(input())
2+
k = int(input())
3+
x = int(input())
4+
y = int(input())
5+
6+
print(min(n, k)*x+max(n-k, 0)*y)

ABC/ABC044/B.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from collections import Counter
2+
s = input()
3+
s = Counter(s)
4+
5+
for i in s.values():
6+
if i%2 != 0:
7+
print('No')
8+
exit()
9+
print('Yes')

ABC/ABC045/A.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
a = int(input())
2+
b = int(input())
3+
h = int(input())
4+
5+
print(int((a+b)*h/2))

ABC/ABC045/B.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from collections import deque
2+
3+
a = deque(input())
4+
b = deque(input())
5+
c = deque(input())
6+
dic = {'A':a, 'B':b, 'C':c}
7+
pop = dic['A'].popleft().upper()
8+
9+
10+
while dic[pop]:
11+
pop = dic[pop].popleft().upper()
12+
13+
print(pop)
14+
15+

ABC/ABC046/A.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from collections import Counter
2+
count = list(map(int, input().split()))
3+
count = Counter(count)
4+
print(len(count))

ABC/ABC046/B.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
n, k = map(int, input().split())
2+
#一つ目はk通り、それ以降は(k-1)通りをn-1回繰り返す
3+
print(int(k*((k-1)**(n-1))))

ABC/ABC047/A.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
a, b, c = map(int, input().split())
2+
3+
if a+b==c or b+c==a or a+c==b:
4+
print('Yes')
5+
else:
6+
print('No')

ABC/ABC047/B.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
w, h, n = map(int, input().split())
2+
field = [[1] * w for _ in range(h)]
3+
for i in range(n):
4+
x, y, a = map(int,input().split())
5+
if a == 1:
6+
for i in range(h):
7+
for j in range(x):
8+
field[i][j] = 0
9+
elif a == 2:
10+
for i in range(h):
11+
for j in range(x, w):
12+
field[i][j] = 0
13+
elif a == 3:
14+
for i in range(y):
15+
for j in range(w):
16+
field[i][j] = 0
17+
elif a == 4:
18+
for i in range(y,h):
19+
for j in range(w):
20+
field[i][j] = 0
21+
22+
count = 0
23+
for i in field:
24+
count += i.count(1)
25+
print(count)

ABC/ABC047/C.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from collections import deque
2+
S = deque(list(input()))
3+
4+
ans = 0
5+
s = S.popleft()
6+
while S:
7+
n = S.popleft()
8+
if s != n:
9+
ans += 1
10+
s = n
11+
print(ans)

ABC/ABC048/A.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
_, s, _ = input().split()
2+
3+
print('A'+s[0].upper()+'C')

ABC/ABC049/A.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
c = input()
2+
3+
if c == 'a' or c == 'i' or c == 'u' or c == 'e' or c == 'o':
4+
print('vowel')
5+
else:
6+
print('consonant')

ABC/ABC049/B.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
h, w = map(int, input().split())
2+
c = [input() for _ in range(h)]
3+
4+
for i in c:
5+
print(i)
6+
print(i)

ABC/ABC050/A.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
a, op, b = input().split()
2+
3+
if op=='+':
4+
print(int(a)+int(b))
5+
else:
6+
print(int(a)-int(b))

ABC/ABC050/B.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
n = int(input())
2+
t = list(map(int, input().split()))
3+
m = int(input())
4+
px = list(tuple(map(int,input().split())) for _ in range(m))
5+
6+
for p, x in px:
7+
ts = t.copy()
8+
ts[p-1] = x
9+
print(sum(ts))

0 commit comments

Comments
 (0)