As an AtCoder diary, I will describe the problem I solved today. Basically, [here](https://qiita.com/drken/items/fd4e5e3630d0f5859067#5-%E9%81%8E%E5%8E%BB%E5%95%8F%E7%B2%BE%E9% It is in the form of solving the problem described in 81% B8-10-% E5% 95% 8F) * 1. When doing competitive programming, I use Paiza.io, which is easier to execute than the local environment.
r,g,b=map(str,input().split())
res=int(r+g+b)
if res%4==0:
print("YES")
else:
print("NO")
The condition was that it was a multiple of 4, so if it was too much, it would be true, right? I thought.
N=int(input())
A=int(input())
s=N%500
if s<=A:
print("Yes")
exit()
print("No")
N=int(input())
A=int(input())
s=N//500
for i in range(A):
if i+s*500==N:
print("Yes")
exit()
print("No")
At first, why not give the total amount and ask for it? I implemented it thinking that. WA came out at the last test, so I reassembled it. The second time, it would be nice if we could make about 500 for a total of 1 yen, right? I created it with the image.
a,b=map(int,input().split())
s=a+b
ss=s//2
s2=s%2
if s2==1:
print(ss+1)
exit()
print(ss)
import math
The method of using a function would be simpler, but I wanted to improve my ability to write algorithms, so I cut it down and then added +1.
(Writing that is not smart at all)
the first
S=input()
cou=int(S.count("o"))*100
print(700+cou)
Second time
S=input()
res=700
for i in S:
if i=="o":
res+=100
print(res)
third time
res=700
for i in input():
if i=="o":
res+=100
print(res)
I thought it would be easy to find it if I looked it up using count and calculated it, so I used count. The second time I wrote using if and for in case count cannot be used. I wrote the third time because I thought I could shorten the code a little.
S=input()
S="2018"+S[4:]
print(S)
print("2018"+input()[4:])
I only had to change the first to 2018, so I changed the first few letters to 2018 and output. If I wanted to shorten it, I could output it in one line.
s=input()
fir=s[0]
las=s[-1]
s=s[1:]
s=s[:-1]
print(fir+str(len(s))+las)
The problem was that it would be good to count the characters in between and combine the first and last characters for output. Substitute the first and last characters Erase the first and last characters Count the characters inside I wrote it as a character string and output it.
s=input()
t=input()
s=sorted(s)
s="".join(s)
t=sorted(t,reverse=True)
t="".join(t)
# print(s,t)
if s<t:
print("Yes")
else:
print("No")
The problem that I was able to understand how to use sorted The code is quite wasteful.
N=int(input())
n=1
while True:
if n>N:
print(int(n/2))
break
n=n*2
The number that can be divided by 2 has the largest value of 2 to the nth power, so I doubled it.
N=int(input())
lis=list(map(int,input().split()))
lis.sort(reverse=True)
print(lis[0]-lis[-1])
I thought it would be good to sort and draw the first and last characters, so I sorted and output. If it's the original article, I'll call it with a for statement! It was written about something, but what should I do?
Recommended Posts