[AtCoder] Solve A problem of ABC101 ~ 169 with Python

Introduction

I solved the A problem of ABC100 ~ 169 of AtCoder with Python.

I'm still a beginner, so I think there is a lot of wasteful code, but I hope it helps someone. ..

ABC169 Problem

A,B=map(int,input().split())
print(A*B)

ABC168 Problem

n=int(input())
n=n%10

if n in [3]:
  print("bon")
elif n in [0,1,6,8]:
  print("pon")
else:
  print("hon")

ABC167 Problem

S=input()
T=input()

if S==T[:-1]:
  print("Yes")
else:
  print("No")

ABC166 Problem

S=input()

if S=="ABC":
  print("AGC")
else:
  print("ABC")

ABC165 Problem

K=int(input())
A,B=map(int,input().split())
a=0

for i in range(A,B+1):
  if i%K==0:
    a+=1
    break

if a==1:
  print("OK")
else:
  print("NG")

ABC164 Problem

S,W=map(int,input().split())

if S<=W:
  print("unsafe")
else:
  print("safe")

ABC163 Problem

import math

R=int(input())
print(math.pi*2*R)

ABC162 Problem

n=input()

if "7" in n:
  print("Yes")
else:
  print("No")

ABC161 Problem

x,y,z=map(int,input().split())
print(z,x,y)

ABC160 Problem

s=input()

if s[2]==s[3] and s[4]==s[5]:
  print("Yes")
else:
  print("No")

ABC159 Problem

N,M=map(int,input().split())

print(N*(N-1)//2+M*(M-1)//2)

ABC158 Problem

S=input()

if S[0]==S[1] or S[1]==S[2]:
  print("NO")
else:
  print("Yes")

ABC157 Problem

N=int(input())

if N%2==0:
  print(N//2)
else:
  print(N//2+1)

ABC156 Problem

N,R=map(int,input().split())

if N>=10:
  print(R)
else:
  print(R+100*(10-N))

ABC155 Problem

a,b,c=map(int,input().split())

if (a==b and a!=c) or (b==c and b!=a) or (c==a and c!=b):
  print("Yes")
else:
  print("No")

ABC154 Problem

S,T=input().split()
a,b=map(int,input().split())
U=input()

if S==U:
  print(a-1,b)
else:
  print(a,b-1)

ABC153 Problem

H,A=map(int,input().split())
cnt=0

while True:
  if H<=0:
    break
  H-=A
  cnt+=1
  
print(cnt)

ABC152 Problem

n,m=map(int,input().split())

if n==m:
  print("Yes")
else:
  print("No")

ABC151 Problem

c=input()
alp="abcdefghijklmnopqrstuvwxyz"

for i in range(len(alp)):
  if alp[i]==c:
    print(alp[i+1])

ABC150 Problem

K,X=map(int,input().split())

if 500*K>=X:
  print("Yes")
else:
  print("No")

ABC149 Problem

S,T=input().split()
print(T+S)

ABC148 Problem

a=int(input())
b=int(input())

print(6-a-b)

ABC147 Problem

a,b,c=map(int,input().split())

if a+b+c>=22:
  print("bust")
else:
  print("win")

ABC146 Problem

s=input()
day=['SUN','MON','TUE','WED','THU','FRI','SAT']

for i in range(7):
  if s==day[i]:
    print(7-i)

ABC145 Problem

r=int(input())
print(r**2)

ABC144 Problem

A,B=map(int,input().split())

if A==0 or A>=10 or B==0 or B>=10:
  print(-1)
else:
  print(A*B)

ABC143 Problem

A,B=map(int,input().split())

if A-B*2<0:
  print(0)
else:
  print(A-B*2)

ABC142 Problem

N=int(input())
odd=0

for i in range(1,N+1):
  if i%2==1:
    odd+=1

print(odd/N)

ABC141 Problem

S=input()

if S[0]=="S":
  print("Cloudy")
elif S[0]=="C":
  print("Rainy")
else:
  print("Sunny")

ABC140 Problem

n=int(input())
print(n**3)

ABC139 Problem

s=input()
t=input()
cnt=0

for i in range(3):
  if s[i]==t[i]:
    cnt+=1
print(cnt)

ABC138 Problem

a=int(input())
s=input()

if a>=3200:
  print(s)
else:
  print('red')

ABC137 Problem

A,B=map(int,input().split())
max=A+B

if max<A-B:
  max=A-B
if max<A*B:
  max=A*B

print(max)

ABC136 Problem

A,B,C=map(int,input().split())

if C-(A-B)<0:
  print(0)
else:
  print(C-(A-B))

ABC135 Problem

A,B=map(int,input().split())

if (A+B)%2==0:
  print((A+B)//2)
else:
  print("IMPOSSIBLE")

ABC134 Problem

r=int(input())
print(3*r*r)

ABC133 Problem

N,A,B=map(int,input().split())

if N*A<B:
  print(N*A)
else:
  print(B)

ABC132 Problem

S=input()
s1=S[0]
s2=0

if S[0]!=S[1]:
  s2=S[1]
elif S[0]!=S[2]:
  s2=S[2]
else:
  s2=S[3]

if S.count(s1)==2 and S.count(s2)==2:
  print("Yes")
else:
  print("No")

ABC131 Problem

S=input()

if S[0]!=S[1] and S[1]!=S[2] and S[2]!=S[3]:
  print("Good")
else:
  print("Bad")

ABC130 Problem

X,A=map(int,input().split())

if X<A:
  print(0)
else:
  print(10)

ABC129 Problem

P,Q,R=map(int,input().split())
min=P+Q

if min>Q+R:
  min=Q+R
if min>R+P:
  min=R+P

print(min)

ABC128 Problem

A,P=map(int,input().split())
print((3*A+P)//2)

ABC127 Problem

A,B=map(int,input().split())

if A>=13:
  print(B)
elif 6<=A<=12:
  print(B//2)
else:
  print(0)

ABC126 Problem

N,K=map(int,input().split())
S=input()

print(S[:K-1]+S[K-1].lower()+S[K:])

ABC125 Problem

A,B,T=map(int,input().split())
print((T//A)*B)

ABC124 Problem

A,B=map(int,input().split())
coin=0

for _ in range(2):
  if A>B:
    coin+=A
    A-=1
  else:
    coin+=B
    B-=1

print(coin)

ABC123 Problem

x=[int(input()) for i in range(5)]
k=int(input())

if x[4]-x[0]<=k:
  print("Yay!")
else:
  print(":(")

ABC122 Problem

b=input()

if b=="A":
  print("T")
elif b=="T":
  print("A")
elif b=="C":
  print("G")
else:
  print("C")

ABC121 Problem

H,W=map(int,input().split())
h,w=map(int,input().split())

print(H*W-h*W-(H-h)*w)

ABC120 Problem

A,B,C=map(int,input().split())

if A*C<=B:
  print(C)
else:
  print(B//A)

ABC119 Problem

s=input()

if s<="2019/04/30":
  print("Heisei")
else:
  print("TBD")

ABC118 Problem

A,B=map(int,input().split())

if B%A==0:
  print(A+B)
else:
  print(B-A)

ABC117 Problem

T,X=map(int,input().split())
print(T/X)

ABC116 Problem

A,B,C=map(int,input().split())
print(A*B//2)

ABC115 Problem

D=int(input())

if D==25:
  print("Christmas")
elif D==24:
  print("Christmas Eve")
elif D==23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")

ABC114 Problem

x=int(input())

if x==7 or x==5 or x==3:
  print("YES")
else:
  print("NO")

ABC113 Problem

X,Y=map(int,input().split())
print(X+Y//2)

ABC112 Problem

n=int(input())

if n==1:
  print("Hello World")
else:
  A=int(input())
  B=int(input())
  print(A+B)

ABC111 Problem

n=int(input())
print(1110-n)

ABC110 Problem

A,B,C=map(int,input().split())
print(max([10*A+B+C,A+10*B+C,A+B+10*C]))

ABC109 Problem

A,B=map(int,input().split())

if (A*B)%2==1:
  print("Yes")
else:
  print("No")

ABC108 Problem

K=int(input())
print(K//2*(K-K//2))

ABC107 Problem

N,i=map(int,input().split())
print(N-i+1)

ABC106 Problem

A,B=map(int,input().split())
print(A*B-B-A+1) 

ABC105 Problem

N,K=map(int,input().split())
if N%K==0:
  print(0)
else:
  print(N//K+1-N//K)

ABC104 Problem

R=int(input())

if R<1200:
  print("ABC")
elif R<2800:
  print("ARC")
else:
  print("AGC")

ABC103 Problem

A1,A2,A3=map(int,input().split())
print(min([abs(A2-A1)+abs(A3-A2),
           abs(A3-A1)+abs(A2-A3),
           abs(A1-A3)+abs(A2-A1)]))

ABC102 Problem

N=int(input())

if N%2==0:
  print(N)
else:
  print(N*2)

ABC101 Problem

S=input()
number=0

for i in range(4):
  if S[i]=="+":
    number+=1
  else:
    number-=1

print(number)

at the end

Please let me know if you have any advice such as this is better!

I will try to solve ABC1 ~ 100 as well.

Recommended Posts

[AtCoder] Solve A problem of ABC101 ~ 169 with Python
[AtCoder] Solve ABC1 ~ 100 A problem with Python
Solve AtCoder ABC168 with python (A ~ D)
Solve AtCoder ABC166 with python
Solve AtCoder ABC 186 with Python
Challenge AtCoder (ABC) 164 with Python! A ~ C problem
Solve ABC163 A ~ C with Python
Solve ABC166 A ~ D with Python
Solve ABC168 A ~ C with Python
Solve ABC162 A ~ C with Python
Solve ABC167 A ~ C with Python
Solve ABC158 A ~ C with Python
Solve AtCoder 167 with python
I wanted to solve the ABC164 A ~ D problem with Python
Solve A ~ D of yuki coder 247 with python
AtCoder ABC 177 Python (A ~ E)
ABC163 C problem with python3
AtCoder ABC 178 Python (A ~ E)
AtCoder ABC 176 Python (A ~ E)
AtCoder ABC 182 Python (A ~ D)
ABC188 C problem with python3
ABC187 C problem with python
[AtCoder explanation] Control the A, B, C problems of ABC182 with Python!
[AtCoder explanation] Control the A, B, C problems of ABC186 with Python!
[AtCoder explanation] Control the A, B, C problems of ABC185 with Python!
[AtCoder explanation] Control the A, B, C problems of ABC187 with Python!
Try to solve a set problem of high school math with Python
[AtCoder explanation] Control the A, B, C problems of ABC184 with Python!
Solve Atcoder ABC176 (A, B, C, E) in Python
[AtCoder explanation] Control the A, B, (C), D problems of ABC165 with Python!
[AtCoder explanation] Control the A, B, C, D problems of ABC183 with Python!
Solve with Ruby and Python AtCoder ABC084 D Cumulative sum of prime numbers
ABC166 in Python A ~ C problem
Solve Atcoder ABC169 A-D in Python
Solve AtCoder Problems Recommendation with python (20200517-0523)
Solve ABC036 A ~ C in Python
Solved AtCoder ABC 114 C-755 with Python3
Template AtCoder ABC 179 Python (A ~ E)
Solve ABC037 A ~ C in Python
[AtCoder explanation] Control the A, B, C, D problems of ABC181 with Python!
AtCoder Beginner Contest 166 A Explanation of Problem "A? C" (Python3, C ++, Java)
[AtCoder explanation] Control ABC180 A, B, C problems with Python!
[AtCoder explanation] Control ABC188 A, B, C problems with Python!
A collection of competitive pro techniques to solve with Python
Solve with Ruby and Python AtCoder ABC133 D Cumulative sum
[AtCoder explanation] Control ABC158 A, B, C problems with Python!
[AtCoder explanation] Control ABC164 A, B, C problems with Python!
[AtCoder explanation] Control ABC168 A, B, C problems with Python!
AtCoder ABC 174 Python
AtCoder ABC187 Python
AtCoder ABC188 Python
AtCoder ABC 175 Python
Solve ABC175 A, B, C in Python
I wanted to solve ABC160 with Python
Python beginner Atcoder memo @ KEYENCE 2020, ABC problem
[Python] Solve 10 past elite problems of Atcoder
Solve ABC165 A, B, D in Python
I wanted to solve ABC172 with Python
[AtCoder commentary] Win the ABC165 C problem "Many Requirements" with Python!
AtCoder Beginner Contest 169 A Explanation of Problem "Multiplication 1" (Python3, C ++, Java)
AtCoder Beginner Contest 176 A Explanation of problem "Takoyaki" (Python3, C ++, Java)