Skip to content
Merged

Dev #21

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## [v3.0.0](https://github.com/KoyanagiHitoshi/AtCoder-Python-Introduction/releases/tag/v3.0.0) / 2023-04-02

* [#21](https://github.com/KoyanagiHitoshi/AtCoder-Python-Introduction/pull/21) update CHANGELOG.md
* [#21](https://github.com/KoyanagiHitoshi/AtCoder-Python-Introduction/pull/21) add code

## [v2.9.0](https://github.com/KoyanagiHitoshi/AtCoder-Python-Introduction/releases/tag/v2.9.0) / 2023-03-05

* [#20](https://github.com/KoyanagiHitoshi/AtCoder-Python-Introduction/pull/20) update CHANGELOG.md
Expand Down
6 changes: 4 additions & 2 deletions code/answer_4-1-100.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
A, B, C = map(int, input().split())
if A <= C <= B:
a, b = map(int, input().split())
graph = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8],
[4, 9], [5, 10], [5, 11], [6, 12], [6, 13], [7, 14], [7, 15]]
if [a, b] in graph:
print("Yes")
else:
print("No")
6 changes: 4 additions & 2 deletions code/answer_4-1-101.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
N = int(input())
if -2**31 <= N < 2**31:
a, b = map(int, input().split())
graph = {(1, 2), (1, 3), (2, 4), (2, 5), (3, 6), (3, 7), (4, 8),
(4, 9), (5, 10), (5, 11), (6, 12), (6, 13), (7, 14), (7, 15)}
if (a, b) in graph:
print("Yes")
else:
print("No")
4 changes: 2 additions & 2 deletions code/answer_4-1-102.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
a, b, c = map(int, input().split())
if a <= b <= c or c <= b <= a:
A, B, C = map(int, input().split())
if A <= C <= B:
print("Yes")
else:
print("No")
12 changes: 4 additions & 8 deletions code/answer_4-1-103.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
X = int(input())
if 0 <= X < 40:
print(40-X)
elif 40 <= X < 70:
print(70-X)
elif 70 <= X < 90:
print(90-X)
N = int(input())
if -2**31 <= N < 2**31:
print("Yes")
else:
print("expert")
print("No")
4 changes: 2 additions & 2 deletions code/answer_4-1-104.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
a, b, c, d = input()
if a == b == c or b == c == d:
a, b, c = map(int, input().split())
if a <= b <= c or c <= b <= a:
print("Yes")
else:
print("No")
12 changes: 8 additions & 4 deletions code/answer_4-1-105.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
a, b, c, d = input()
if a != b != c != d:
print("Good")
X = int(input())
if 0 <= X < 40:
print(40-X)
elif 40 <= X < 70:
print(70-X)
elif 70 <= X < 90:
print(90-X)
else:
print("Bad")
print("expert")
4 changes: 2 additions & 2 deletions code/answer_4-1-106.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
A, B = map(int, input().split())
if A <= B <= 6*A:
a, b, c, d = input()
if a == b == c or b == c == d:
print("Yes")
else:
print("No")
8 changes: 4 additions & 4 deletions code/answer_4-1-107.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
A, B = map(int, input().split())
if 1 <= A <= 9 and 1 <= B <= 9:
print(A*B)
a, b, c, d = input()
if a != b != c != d:
print("Good")
else:
print(-1)
print("Bad")
8 changes: 4 additions & 4 deletions code/answer_4-1-108.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
V, T, S, D = map(int, input().split())
if V*T <= D <= V*S:
print("No")
else:
A, B = map(int, input().split())
if A <= B <= 6*A:
print("Yes")
else:
print("No")
8 changes: 4 additions & 4 deletions code/answer_4-1-109.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
A, B, X = map(int, input().split())
if A <= X <= A+B:
print("YES")
A, B = map(int, input().split())
if 1 <= A <= 9 and 1 <= B <= 9:
print(A*B)
else:
print("NO")
print(-1)
8 changes: 4 additions & 4 deletions code/answer_4-1-110.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
A, B, X = map(int, input().split())
if 0 <= X-A <= B:
print("YES")
V, T, S, D = map(int, input().split())
if V*T <= D <= V*S:
print("No")
else:
print("NO")
print("Yes")
14 changes: 4 additions & 10 deletions code/answer_4-1-111.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
S, T, X = map(int, input().split())
if S < T:
if S <= X < T:
print("Yes")
else:
print("No")
A, B, X = map(int, input().split())
if A <= X <= A+B:
print("YES")
else:
if X < T or S <= X:
print("Yes")
else:
print("No")
print("NO")
8 changes: 4 additions & 4 deletions code/answer_4-1-112.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
n = int(input())
if 2 <= n <= 4:
print("No")
A, B, X = map(int, input().split())
if 0 <= X-A <= B:
print("YES")
else:
print("Yes")
print("NO")
11 changes: 11 additions & 0 deletions code/answer_4-1-113.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
S, T, X = map(int, input().split())
if S < T:
if S <= X < T:
print("Yes")
else:
print("No")
else:
if X < T or S <= X:
print("Yes")
else:
print("No")
5 changes: 5 additions & 0 deletions code/answer_4-1-114.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
n = int(input())
if 2 <= n <= 4:
print("No")
else:
print("Yes")
5 changes: 3 additions & 2 deletions code/answer_4-1-96.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
A, B = input().split()
if "2" in A or "2" in B:
N = int(input())
S = input()
if "MM" in S or "FF" in S:
print("No")
else:
print("Yes")
9 changes: 5 additions & 4 deletions code/answer_4-1-97.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
AB = input()
if "2" in AB:
print("No")
else:
N = int(input())
S = input()
if S in "MF"*51:
print("Yes")
else:
print("No")
10 changes: 4 additions & 6 deletions code/answer_4-1-98.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
a, b = map(int, input().split())
graph = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8],
[4, 9], [5, 10], [5, 11], [6, 12], [6, 13], [7, 14], [7, 15]]
if [a, b] in graph:
print("Yes")
else:
A, B = input().split()
if "2" in A or "2" in B:
print("No")
else:
print("Yes")
10 changes: 4 additions & 6 deletions code/answer_4-1-99.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
a, b = map(int, input().split())
graph = {(1, 2), (1, 3), (2, 4), (2, 5), (3, 6), (3, 7), (4, 8),
(4, 9), (5, 10), (5, 11), (6, 12), (6, 13), (7, 14), (7, 15)}
if (a, b) in graph:
print("Yes")
else:
AB = input()
if "2" in AB:
print("No")
else:
print("Yes")
4 changes: 2 additions & 2 deletions code/answer_4-2-10.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
N = int(input())
for i in range(N, -1, -1):
print(i)
for i in range(N+1):
print(N-i)
5 changes: 2 additions & 3 deletions code/answer_4-2-11.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
N = int(input())
print(N)
for i in range(N):
print(1)
for i in range(N, -1, -1):
print(i)
7 changes: 3 additions & 4 deletions code/answer_4-2-12.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
N, X = map(int, input().split())
P = list(map(int, input().split()))
N = int(input())
print(N)
for i in range(N):
if P[i] == X:
print(i+1)
print(1)
16 changes: 5 additions & 11 deletions code/answer_4-2-13.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
N, S, T = map(int, input().split())
W = int(input())
day = 0
if S <= W <= T:
day += 1
for i in range(N-1):
A = int(input())
W += A
if S <= W <= T:
day += 1
print(day)
N, X = map(int, input().split())
P = list(map(int, input().split()))
for i in range(N):
if P[i] == X:
print(i+1)
25 changes: 11 additions & 14 deletions code/answer_4-2-14.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
A, B, C, D, E, F, X = map(int, input().split())
takahashi = 0
aoki = 0
for i in range(X):
if i % (A+C) < A:
takahashi += B
if i % (D+F) < D:
aoki += E
if takahashi > aoki:
print("Takahashi")
elif takahashi < aoki:
print("Aoki")
else:
print("Draw")
N, S, T = map(int, input().split())
W = int(input())
day = 0
if S <= W <= T:
day += 1
for i in range(N-1):
A = int(input())
W += A
if S <= W <= T:
day += 1
print(day)
20 changes: 13 additions & 7 deletions code/answer_4-2-15.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
K = int(input())
A, B = map(int, input().split())
for i in range(A, B+1):
if i % K == 0:
print("OK")
break
A, B, C, D, E, F, X = map(int, input().split())
takahashi = 0
aoki = 0
for i in range(X):
if i % (A+C) < A:
takahashi += B
if i % (D+F) < D:
aoki += E
if takahashi > aoki:
print("Takahashi")
elif takahashi < aoki:
print("Aoki")
else:
print("NG")
print("Draw")
9 changes: 5 additions & 4 deletions code/answer_4-2-16.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
A, B, C = map(int, input().split())
K = int(input())
A, B = map(int, input().split())
for i in range(A, B+1):
if i % C == 0:
print(i)
if i % K == 0:
print("OK")
break
else:
print(-1)
print("NG")
11 changes: 7 additions & 4 deletions code/answer_4-2-17.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
N = int(input())
while N >= 0:
print(N)
N -= 1
A, B, C = map(int, input().split())
for i in range(A, B+1):
if i % C == 0:
print(i)
break
else:
print(-1)
13 changes: 9 additions & 4 deletions code/answer_4-2-18.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
a, b, n = [int(input()) for i in range(3)]
while n % a != 0 or n % b != 0:
n += 1
print(n)
N = int(input())
W = input().split()
S = {"and", "not", "that", "the", "you"}
for w in W:
if w in S:
print("Yes")
break
else:
print("No")
12 changes: 8 additions & 4 deletions code/answer_4-2-19.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
a, b, n = [int(input()) for i in range(3)]
while not (n % a == 0 and n % b == 0):
n += 1
print(n)
N = int(input())
S = input()
for i in range(N-1):
if S[i] == S[i+1]:
print("No")
break
else:
print("Yes")
9 changes: 9 additions & 0 deletions code/answer_4-2-20.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
N = int(input())
S = input()
for i in range(N-1):
if S[i] != S[i+1]:
continue
print("No")
break
else:
print("Yes")
4 changes: 4 additions & 0 deletions code/answer_4-2-21.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
N = int(input())
while N >= 0:
print(N)
N -= 1
4 changes: 4 additions & 0 deletions code/answer_4-2-22.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a, b, n = [int(input()) for i in range(3)]
while n % a != 0 or n % b != 0:
n += 1
print(n)
4 changes: 4 additions & 0 deletions code/answer_4-2-23.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a, b, n = [int(input()) for i in range(3)]
while not (n % a == 0 and n % b == 0):
n += 1
print(n)
7 changes: 4 additions & 3 deletions code/answer_4-2-5.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
N = int(input())
for i in range(N):
A, B = map(int, input().split())
print(A+B)
A = list(map(int, input().split()))
for a in A:
if a % 2 == 0:
print(a, end=" ")
9 changes: 4 additions & 5 deletions code/answer_4-2-6.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
S, T = map(int, input().split())
picture = 0
for i in range(S, T+1):
picture += 1
print(picture)
N = int(input())
for i in range(N):
A, B = map(int, input().split())
print(A+B)
Loading