โ 8958 OX ํด์ฆ โ
N = int(input())
for _ in range(N):
string = input()
score = 0
add = 0
for ch in string:
if ch == 'X':
add = 0
continue
add += 1
score += add
print(score)
โ 1259 ํฐ๋ฆฐ๋๋กฌ์ โ
while 1:
N = input()
if N == '0': break
print('yes' if N == N[::-1] else 'no')
โ 1157 ๋จ์ด ๊ณต๋ถ โ
word = list(input().lower())
ans = {}
for letter in 'abcdefghijklmnopqrstuvwxyz':
ans[letter] = word.count(letter)
max_keys = [key for key, value in ans.items() if value == max(ans.values())]
if len(max_keys) > 1:
print('?')
else:
print(max_keys[0].upper())
๐ list comprehension์ผ๋ก dictionary value ์ต๋๊ฐ์ผ ๋์ keys๋ฅผ ํ ๊ฐ์ list๋ก ๋ชจ์๋ค → ์ต๋๊ฐ์ผ ๋์ key ๊ฐ์๊ฐ 1๊ฐ๋ณด๋ค ๋๋ ์ง ์๋ ์ง์ ๋ฐ๋ผ ๋ง๊ฒ ์ถ๋ ฅํ๋ฉด ๋จ
โ 18198 Basketball One-on-One โ
res = input()
players = []
scores = []
A = 0
B = 0
alt = 0
flag = 0
for p in res[::2]:
players.append(p)
for s in res[1::2]:
scores.append(int(s))
for p,s in zip(players,scores):
if p == 'A':
A += s
else:
B += s
print('A') if A > B else print('B')
๐ ์ฃผ์ด์ง ๋ฌธ์์ด ์์ ์์น๋ณ step์ 2์ฉ ๊ฑด๋๋ฐ๋ฉด์, zip()์ผ๋ก ๊ฐ๊ฐ ๋น๊ตํ๋ ํ์ด๋ก ์งํ! ์ฝ๋ ํํ๋ฅผ ๊ธฐ์ตํ์
โ 25813 Changing Strings โ
s=input()
x=s.find('U')
y=s.rfind('F')
print('-'*x+'U'+'C'*(y-x-1)+'F'+'-'*(len(s)-y-1))
๐ ์ผ์ชฝ์์ U๊ฐ ์ฒซ ๋ฑ์ฅํ๋ ์์น, ์ค๋ฅธ์ชฝ์์ F๊ฐ ์ฒซ ๋ฑ์ฅํ๋ ์์น๋ฅผ ๊ฐ๊ฐ find์ rfind๋ก ์ฝ๊ฒ ์ฐพ๋๋ค! ์ดํ ๋ฐ๋ก ์ถ๋ ฅ
s = input()
ans = ''
start,end = 0,0
for ch in s:
if ch == 'U':
start = s.index(ch)
for ch in s[::-1]:
if ch == 'F':
end = (len(s)-1 - s[::-1].index(ch))
for i in range(0,len(s)):
if i < start or end < i:
ans += '-'
elif start < i < end:
ans += 'C'
elif i == start:
ans += 'U'
else:
ans += 'F'
print(ans)
โ 1032 ๋ช ๋ น ํ๋กฌํํธ โ
N=int(input())
patterns=[]
ans=[]
for _ in range(N):
patterns.append(input())
length = len(patterns[0])
for i in range(length):
compared=[]
for j in range(N):
compared.append(patterns[j][i])
if len(set(compared)) == 1:
ans.append(patterns[j][i])
else:
ans.append('?')
print(*ans,sep='')
โ 5358 Football Team โ
while 1:
try:
name=list(input())
l=len(name)
for i in range(l):
if name[i]=='i':name[i]='e'
elif name[i]=='e':name[i]='i'
elif name[i]=='I':name[i]='E'
elif name[i]=='E':name[i]='I'
print(*name,sep='')
except EOFError:break
๐ file์ ๋์ ๋ค๋ค๋ฅผ ๋๋ ๊ณ์ ์ ๋ ฅ์ ๋ฐ์ง ๋ง์์ผ ํ๋ฏ๋ก try-except ๊ตฌ๋ฌธ์ธ์์ EOFError ์ค์ ๊ผญ! ํด์ฃผ๊ธฐ / python string ์ผ๋ถ ๋ด์ฉ๋ง ๋ฐ๊ฟ assignmentํ๋ ๊ฑด string ์์ฒด๋ฅผ list๋ก ๋ณํํด์ ๋ฐ๊พธ๋๊ฐ, ์๋๋ฉด replace() ํจ์๋ฅผ ํ์ฉํด์ผ ํ๋ค
โ 26198 Chronogram โ
chronogram='IVXLCDM'
values=[1,5,10,50,100,500,1000]
for _ in range(int(input())):
sentence=input()
t=0
for i in sentence:
if i in chronogram:
t+=values[chronogram.index(i)]
print(t)
๐ ๋ฌธ์์ด๊ณผ list๋ฅผ ๊ฐ๊ฐ ๋ง๋ค๊ณ , ๋ฌธ์์ด์ index์ ๋ง๋ values์ ๊ฐ์ ๋ํ๋ idea๋ก ์ํ๋ ๋ฌธ์์ value๋ฅผ ๊ณ์ add up ํ ์ ์์
โ 18813 Divisions Spelling โ
import sys
input=sys.stdin.readline
alphabets='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
n,m=map(int,input().split())
ans=0
for _ in range(n):
questions=alphabets[:m]
cnt=0
word=input().rstrip()
for j in word:
if j not in questions:
break
questions = questions.replace(j, '')
cnt+=1
if cnt==len(word):ans+=1
print(ans)
๐ ์ฃผ์ด์ง ์ํ๋ฒณ์์, ๊ฐ๊ฐ ๋ธ ๋จ์ด์ ์ํ๋ฒณ์ด ๋ชจ๋ ํฌํจ๋์ด ์๋ ์ง ๋ฌป๋ ๋ฌธ์ ์ด๋ค. ๋จ, 2๋ฒ ์ด์ ํฌํจ๋๋ฉด ์๋๋ฏ๋ก, replace()๋ฅผ ์ฌ์ฉํ์ฌ ์ํ๋ ์ํ๋ฒณ์ ์ญ์ ํ๊ฒ๋ ์ค์ ํจ
โ 25630 ํฐ๋ฆฐ๋๋กฌ ์๋ก์๋ก โ
N=int(input())
s=input()
t=0
for i in range(N//2):
if s[i]!=s[N-1-i]:t+=1
print(t)
๐ ๋ฌธ์์ด์ ์ ๋ฐ๊น์ง(์ ํํ ์๊ธฐํ๋ฉด ์ ๋ฐ๋ณด๋ค ์์ ๋จ๊ณ๊น์ง) ์งํํ๋ฉด์ ์๊ณผ ๋ค์ ๋ฌธ์๊ฐ ๋ค๋ฅด๋ฉด ์นด์ดํธ!
โ 26502 Decoder โ
for _ in range(int(input())):
a=[]
for i in input():
if i in 'yaeiouYAEIOU':
a.append('aeiouyAEIOUY'['yaeiouYAEIOU'.find(i)])
else: a.append(i)
print(*a,sep='')
โ 9443 Arrangement of Contest โ
import sys
input=sys.stdin.readline
t=[]
N=int(input())
for _ in range(N):
problem=input()
t.append(problem[0])
l=sorted(set(t))
a=0
if l[0]=='A':
a+=1
for i in range(1,len(l)):
if ord(l[i])-ord(l[i-1]) == 1:a+=1
else: break
print(a)
๐ ์กฐ๊ฑด์ด ๊น๋ค๋ก์ด ๋ฌธ์ , ์ ๊ธ์๋ง ๋ด ๋ค set() ์ฐ์ฐ์ผ๋ก ์ค๋ณต ์์ฐ. ๊ทธ ์ํ์์ A๋ถํฐ BCDE~ ์ฐ์ํ ์ํ๋ฒณ์ ๊ธธ์ด ๊ฐ์๋ฅผ ๊ตฌํ๋ ๋ฌธ์ / IndexError๋ก for๋ฌธ์ set()๋ก ์ค์ธ ์งํฉ์ ๊ธธ์ด๋งํผ๋ง iteration ์งํ ์์ง ๋ง๊ธฐ
โ 4388 ๋ฐ์์ฌ๋ฆผ โ
while 1:
a,b=input().split()
if (a,b)==('0','0'):break
la=len(a)
lb=len(b)
ans,yes=0,0
for i in range(1,max(la,lb)+1):
if i <= min(la,lb):
if yes==1:
if (int(a[-i]) + int(b[-i]) + 1)>= 10:
ans+=1
else:
yes-=1
else:
if (int(a[-i]) + int(b[-i])) >= 10:
ans+=1
yes+=1
else:
if la > lb:
if yes==1:
if (int(a[-i])+1)>=10:
ans+=1
else:
break
else:
if yes==1:
if (int(b[-i])+1)>=10:
ans+=1
else:
break
print(ans)
๐ ์ฐ์ฐ์์์ carry ๊ฐ์๋ฅผ ๋ฌป๋ ๋ฌธ์ / ์๋ฅผ ๊ฐ๊ฐ ๋ฌธ์์ด๋ก ๊ฐ์ฃผํ ๋ค, ๋ค๋ถํฐ ์ฐจ๋ก๋๋ก 1์ฉ ์๋ฆฌ์๋ฅผ ์ฌ๋ ค๊ฐ๋ฉฐ ์ด๋ฏธ ์์ ์ฌ๋ ค์ง ๊ฒฝ์ฐ / ์๋ ๊ฒฝ์ฐ ๊ฐ๊ฐ if๋ฌธ์ผ๋ก ๋๋์ด carry ๊ฐ์๋ฅผ ๊ณ์ ์นด์ดํ / ๋จ, ์๋ก ์๋ฆฌ์๊ฐ ๋ค๋ฅผ ๊ฒฝ์ฐ ํฐ ์์ ๋ํด์๋ง ๋ค์ if๋ฌธ์ผ๋ก ์ธ์ ์ฐ์ฐ
(+์์ ์์ ์ ์์๋ฆฌ์ชฝ์ ์ญ 0์ ๋์ดํด์ ํธํ๊ฒ ์์ธ๋ฅผ ์ฒ๋ฆฌํ์ง ์๋ ํ์ด๋ ๊ฐ๋ฅ)
โ 25870 Parity of Strings โ
string=input()
counts=dict()
for letter in string:
if letter not in counts.keys():
counts[letter] = 1
else:
counts[letter] +=1
counts_l = list(counts.values())
for i in range(len(counts_l)):
if counts_l[i] % 2 == 1:
counts_l[i] = 1
else: counts_l[i] = 0
total = sum(counts_l)
if total == len(counts_l):
print(1)
elif total == 0:
print(0)
else:
print(2)
โ 5622 ๋ค์ด์ผ โ
word=input()
letters='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
cnt='33344455566677788889990000'
ans=0
for letter in word:
if cnt[letters.find(letter)] == '0':
ans+=10
else:
ans += int(cnt[letters.find(letter)])
print(ans)
๐ find()๋ฅผ ์ด์ฉํด์ ์ํ๋ ์ซ์์ index๋ฅผ ์ฐพ๊ณ , 0์ผ ๊ฒฝ์ฐ 10์ ๋ํ๊ณ , ์๋๋ฉด ์ซ์ ๊ทธ ์์ฒด๋ฅผ ๋์ ์ผ๋ก ๋ํด์ ์ต์ข ํฉ๊ณ ์ถ๋ ฅ
โ 10798 ์ธ๋ก์ฝ๊ธฐ โ
import sys
input=sys.stdin.readline
chs=[[] for _ in range(5)]
ans=[]
for i in range(5):
chs[i] = input().rstrip()
for i in range(15):
for word in chs:
if (i+1) <= len(word):
ans.append(word[i])
print(*ans,sep='')
๐ 2์ฐจ์ ๋ฐฐ์ด์ ๋๋ฆฌ๊ธฐ ์ํด for๋ฌธ ์ค์ฒฉ์ ์ฌ์ฉํด์ indexing์ผ๋ก ํ ๋ฒ์ ์ฝ๊ฒ ์ฝ๋๋ฅผ ์งฐ์. ์ด ๋ len(word) ๋ณด๋ค i+1์ ๊ฐ์ด ๊ฐ๊ฑฐ๋ ์์์ผ ํ ๋๋ ๊ธ์๊ฐ ์กด์ฌํ๋ ๊ฒ์ด๋ฏ๋ก if๋ฌธ ์กฐ๊ฑด ๋ฌ๊ณ ๋น ๋ฆฌ์คํธ์ ์ญ ๋ชจ์ ๋ค์ ํ๋ฒ์ ์ถ๋ ฅ!
โ 10205 ํค๋ผํด๋ ์ค์ ํ๋๋ผ โ
for i in range(1,int(input())+1):
h=int(input())
behaviors=input()
flag=0
for x in behaviors:
if h==0:
break
if x=='c':
h+=1
else:
h-=1
print(f'Data Set {i}:\n{h}')
print()
๐ง๐ผโ๏ธ ๋จธ๋ฆฌ 1๊ฐ๋ฅผ ์๋ฅด๋ฉด 2๊ฐ๊ฐ ๋์ค๋ ๊ฑด, ๊ฒฐ๊ตญ ๋จธ๋ฆฌ๊ฐ 1๊ฐ๊ฐ ์๊ธด๋ค๋ ๋ป! c์ผ ๊ฒฝ์ฐ b์ผ ๊ฒฝ์ฐ ์ํฉ๋ณ๋ก ์ ํด์๋ง ํ๋ฉด ๋จ
โ 21866 ์ถ์ฒจ์ ํตํด ์ปคํผ๋ฅผ ๋ฐ์ โ
scores=list(map(int,input().split()))
total=sum(scores)
if total < 100: print('none')
else:
if scores[0]>100 or scores[1]>100 or scores[2]>200 or scores[3]>200 or scores[4]>300 or scores[5]>300 or scores[6]>400 or scores[7]>400 or scores[8]>500:
print('hacker')
else:
print('draw')
โ 18698 The Walking Adam โ
for _ in range(int(input())):
cnt = 0
for i in input():
if i == 'D':
break
else:
cnt += 1
print(cnt)
๐ 'D'๋ฅผ ๋ง๋๋ฉด fall downํ๋ฏ๋ก ๊ทธ ๋๊น์ง์ U ๊ฐ์๋ฅผ for๋ฌธ์ผ๋ก ๊ตฌํ๊ณ ์ํฉ์ ๋ง๊ฒ break๋ฌธ ์ค์ ํ๋ฉด ๋!
โ 2444 ๋ณ ์ฐ๊ธฐ - 7 โ
N=int(input())
for i in range(1,N):
print(' '*(N-i)+'*'*(2*i-1))
for i in range(N,0,-1):
print(' '*(N-i)+'*'*(2*i-1))
โ 26489 Gum Gum for Jay Jay โ
a=0
while 1:
try:
input()
a+=1
except EOFError:break
print(a)
๐ file์ ๋์ ๋ง๋๋ฉด try-except๋ฌธ์ผ๋ก EOFError์ผ ๋ break๋ฌธ ์ค์ !
โ 24196 Gömda ord โ
s=input()
l=len(s)
i=0
while i<=(l-1):
print(s[i],end='')
i+=(ord(s[i])-64)
๐ A๋ผ๋ฉด ํ์ฌ ์์น์์ 1๋งํผ ์ด๋ํด ํ๋ฆฐํธ, ord() ํจ์๋ฅผ ์ด์ฉํด 64๋ฅผ ๋บ ์ ์๊ฐ๋งํผ ์ ํํด์ ์ถ๋ ฅ
โ 27433 ํฉํ ๋ฆฌ์ผ 2 โ
N=int(input())
ans=1
for i in range(1,N+1):
ans*=i
print(ans)
โ 27434 ํฉํ ๋ฆฌ์ผ 3 โ
๐ ์์ ์ฝ๋ ๋์ผ
โ 17174 ์ ์ฒด ๊ณ์ฐ ํ์ โ
N,M=map(int,input().split())
ans=N
while 1:
if N//M==0:break
ans+=(N//M)
N//=M
print(ans)
๐ ๋ชซ์ด 0์ด ๋ ๋๊น์ง M๊ฐ์ฉ ๊ณ์ ๋ฌถ์ผ๋ฉด์ ๋ฌถ์ธ ๋ชซ์ ๊ณ์ add upํด ์ต์ข ๊ฒฐ๊ณผ ์ถ๋ ฅ!
โ 23804 ๊ณจ๋ฑ ์ด ์ฐ๊ธฐ - ใท โ
N=int(input())
for _ in range(N):
print('@'*(5*N))
for _ in range(3*N):
print('@'*N)
for _ in range(N):
print('@'*(5*N))
โ 23812 ๊ณจ๋ฑ ์ด ์ฐ๊ธฐ - ๋์๊ฐ ใ โ
N=int(input())
size=5*N
for _ in range(N):
print('@'*N+' '*3*N+'@'*N)
for _ in range(N):
print('@'*size)
for _ in range(N):
print('@'*N+' '*3*N+'@'*N)
for _ in range(N):
print('@'*size)
for _ in range(N):
print('@'*N+' '*3*N+'@'*N)
โ 11648 ์ง์ โ
n = input()
level = 0
while 1:
if len(n) == 1:
print(level)
break
next = 1
for i in n:
next*=int(i)
n = str(next)
level+=1
โ 23808 ๊ณจ๋ฑ ์ด ์ฐ๊ธฐ - ใ โ
N=int(input())
width = N*5
for _ in range(2*N):
print('@'*N+' '*3*N+'@'*N)
for _ in range(N):
print('@'*width)
for _ in range(N):
print('@'*N+' '*3*N+'@'*N)
for _ in range(N):
print('@'*width)
โ 9306 Practice: Roll Call โ
import sys
input=sys.stdin.readline
n=int(input())
for i in range(1,n+1):
first=input().rstrip()
last=input().rstrip()
print(f'Case {i}: {last}, {first}')
โ 20233 Bicycle โ
l = [int(input()) for _ in range(5)]
f = l[0]
s = l[2]
if l[4] < 30:
print(f,s)
elif l[4] < 45:
print(f+l[1]*(l[4]-30)*21,s)
else:
print(f+l[1]*(l[4]-30)*21,s+l[3]*(l[4]-45)*21)
๐ ํต๊ทผ์๊ฐ์ด ๊ฐ ์ต์ ์ 30๋ถ๊ณผ 45๋ถ๋ณด๋ค ์ ๊ฒ ์์๋ ๊ฒฝ์ฐ๋ง ์ํฉ ์ ์ธ์ฐ๋ฉด ๋
โ 25893 Majestic 10 โ
๐ 10์ด์์ธ ์ซ์์ ๊ฐ์๊ฐ ์ด ๋ช ๊ฐ์ธ์ง์ ๋ฐ๋ผ ๊ฒฝ์ฐ์ ์๋ฅผ ๋ค๋ฅด๊ฒ if๋ฌธ์ผ๋ก ๋๋ฆฌ๋ฉด ๋๋ค.
for _ in range(int(input())):
a,b,c=map(int,input().split())
if a < 10 and b < 10 and c < 10:
print(a,b,c)
print('zilch','\n')
elif (a>=10 and b < 10 and c < 10) or (b>=10 and a < 10 and c < 10) or (c>=10 and a < 10 and b <10):
print(a,b,c)
print('double','\n')
elif (a>=10 and b >= 10 and c < 10) or (b>=10 and c>=10 and a < 10) or (a>=10 and c>=10 and b < 10):
print(a,b,c)
print('double-double','\n')
else:
print(a,b,c)
print('triple-double','\n')
๐ 10์ด์์ผ ๊ฒฝ์ฐ ๋ณ์์ 1์ฉ ๋ํด, ๋ต์ด ๋๋ ๊ฒฝ์ฐ๋ค์ ๋ชจ๋ list์ ๋ง๋ค์ด indexing์ผ๋ก ํธ๋ ํด๊ฒฐ๋ฒ๋ ์กด์ฌ
for _ in range(int(input())):
s=input()
print(s)
n=0
for i in list(map(int,s.split())):
if i>9:
n+=1
print(["zilch","double","double-double","triple-double"][n]+"\n")
โ 21612 Boiling Water โ
B = int(input())
P = 5*B - 400
if P < 100:
print(P,1,sep='\n')
elif P == 100:
print(P,0,sep='\n')
else:
print(P,-1,sep='\n')
๐ ๋๋์ ์ ๋ฐ๋ผ ํด์๋ฉด ์๋์ธ์ง, ํด์๋ฉด์ธ์ง, ์์ธ์ง ๊ฒฐ์ ํด์ฃผ๋ if๋ฌธ ๋ฌธ์ ! ๋ฌธ์ ์ ๋ง๊ฒ ์ํฉ ๋๋์ด ํ๋ฉด ๋จ :)
โ 13597 Tri-du โ
a,b=map(int,input().split())
if a == b:
print(a)
else:
print(max(a,b))
๐ ๋ ์ฅ์ด ๊ฐ์ผ๋ฉด ๋ชจ๋ ๊ฐ๊ฒ ํด์ผ ์ต๊ณ ์ , ๋ ์ฅ์ด ์๋ก ๋ค๋ฅผ ๊ฒฝ์ฐ, ๋ ์ฅ ์ค ํฐ ๊ฐ ํ ์ฅ์ ์ถ๊ฐํด์ผ ์ต๊ณ ์ ! ๊ฒ์ ์ดํดํ๋ฉด ์ํฉ๋ณ๋ก ์ฝ๋์ง๋ฉด ๋จ :)
โ 16017 Telemarketer or not? โ
ns=[int(input()) for _ in range(4)]
if (ns[1] == ns[2]) and ns[0] in [8,9] and ns[3] in [8,9]:
print('ignore')
else:
print('answer')
๐ telemarketer ๋ฒํธ์ธ์ง ์๋์ง์ ๋ฐ๋ผ ์กฐ๊ฑด ๋๋์ด ๊ตฌํ๋ฉด ๋!
โ 21354 Äpplen och päron โ
a,b=map(int,input().split())
if 7*a == 13*b:
print('lika')
elif 7*a > 13*b:
print('Axel')
else:
print('Petra')
โ 21638 SMS from MCHS โ
t1,v1=map(int,input().split())
t2,v2=map(int,input().split())
if t2 < 0 and v2 >= 10:
print('A storm warning for tomorrow! Be careful and stay home if possible!')
elif t1 > t2:
print('MCHS warns! Low temperature is expected tomorrow.')
elif v2 > v1:
print('MCHS warns! Strong wind is expected tomorrow.')
else:
print('No message')
๐ ์ค๋, ๋ด์ผ ๋ ์จ ์ํฉ์ ๋ฐ๋ผ ๋ค๋ฅด๊ฒ ๋ถ๊ธฐ ์ ์ฉํ๋ฉด ๋!
โ 19602 Dog Treats โ
S=int(input())
M=int(input())
L=int(input())
if (1*S + 2*M + 3*L) >= 10:
print('happy')
else:
print('sad')
๐ 10์ด์์ด๋ฉด happy! ์๋๋ฉด sad :(
โ 15059 Hard Choice โ
Ca,Ba,Pa=map(int,input().split())
Cr,Br,Pr=map(int,input().split())
ans = 0
if Cr > Ca:
ans += (Cr-Ca)
if Br > Ba:
ans += (Br-Ba)
if Pr > Pa:
ans += (Pr-Pa)
print(ans)
๐ ๊ฐ meal choice์ ๋์ ๊ด๊ณ์ ๋ฐ๋ผ ๋ถ์กฑํ๋ฉด ๊ณ์ ๋์ ์ผ๋ก ๋ํด ๊ฒฐ๊ณผ๋ฅผ ํ๋ฆฐํธํ๋ฉด ๋จ
โ 20673 Covid-19 โ
p = int(input())
q = int(input())
if p <=50 and q<= 10:
print('White')
elif q > 30:
print('Red')
else:
print('Yellow')
๐ ์์ด ์ง๋ฌธ ์ ์ฝ๊ณ ํ๋ฉด ๋จ
โ 25704 ์ถ์ ์ด๋ฒคํธ โ
N = int(input())
P = int(input())
if N < 5:
print(P)
elif N < 10:
print(0) if (P-500) < 0 else print(P-500)
elif N < 15:
if (P-500) < P*0.9:
print(0) if (P-500) < 0 else print(P-500)
else:
print(int(P*0.9))
elif N < 20:
if (P-2000) < P*0.9:
print(0) if (P-2000) < 0 else print(P-2000)
else:
print(int(P*0.9))
else:
if (P-2000) < P*0.75:
print(0) if (P-2000) < 0 else print(P-2000)
else:
print(int(P*0.75))
๐ %์ ์ ํ ์ธ ๋ ์ต์ ์ค ๋ฌด์์ด ๋ ์ต์ ์ธ์ง ์ ์ฌ๋ฌ if๋ฌธ ๋ถ๊ธฐ๋ฅผ ๋ง๋ค์ด์ ์์ฑํ๋ฉด ๋๋ค. (๊ธ์ก์ ๋ฌด์กฐ๊ฑด 0์ด์์ด๋ฏ๋ก, ์์์ผ ๋ 0 ๊ผญ)
โ 16099 Larger Sport Facility โ
for _ in range(int(input())):
a,b,c,d=map(int,input().split())
print('Eurecom') if a*b < c*d else print('TelecomParisTech') if a*b > c*d else print('Tie')
โ 25932 Find the Twins โ
for i in range(int(input())):
l=list(map(int,input().split()))
print(*l)
if 18 in l:
if 17 in l:
print('both')
else:
print('mack')
elif 17 in l:
print('zack')
else:
print('none')
print('')
โ 16727 ICPC โ
p1,s1=map(int,input().split())
s2,p2=map(int,input().split())
if (p1+p2) > (s1+s2):
print('Persepolis')
elif (s1+s2) > (p1+p2):
print('Esteghlal')
else:
if s1 > p2:
print('Esteghlal')
elif p2 > s1:
print('Persepolis')
else:
print('Penalty')
๐ ์ด ํฉ๊ณ๊ฐ ๊ฐ์ ๊ฒฝ์ฐ๋ง ๋ฌธ์ ์ ์ฝ๊ณ ์ฝ๋ฉํ๋ฉด ๋จ
โ 18247 ๊ฒจ์ธ์๊ตญ ํฐ์ผ ์๋งค โ
for _ in range(int(input())):
M,N=map(int,input().split())
if M < 12 or N < 4:
print(-1)
else:
print(11*N+4)
๐ L์ด์ 4๋ฒ์งธ ์ข์์ด ์กด์ฌํด์ผ ํ๋ฏ๋ก, ์ด์ ๊ฐ์๊ฐ 12๋ณด๋ค ์ ๊ฑฐ๋, ํ์ ๊ฐ์๊ฐ 4๋ณด๋ค ์ ์ผ๋ฉด ์๋๋ค.
โ 9635 Balloons Colors โ
for _ in range(int(input())):
N,X,Y=map(int,input().split())
colors=list(map(int,input().split()))
if X == colors[0] and Y == colors[-1]:
print('BOTH')
elif X == colors[0]:
print('EASY')
elif Y == colors[-1]:
print('HARD')
else:
print('OKAY')
๐ธ ๋ฌธ์ ๋ฅผ ์ ์ฝ๊ณ , ๋งจ ์๊ณผ ๋งจ ๋ค์ ํ์ ๋ฒํธ๊ฐ ์ง์ ๋ฒํธ์ ๊ฐ์ ์ง, ๋ค๋ฅธ ์ง์ ๋ฐ๋ผ ์ํฉ ๋๋์ด ํ๋ฆฐํธํ๋ฉด ๋!
โ 11367 Report Card Time โ
def get_grade(n):
if 97<=n<=100:return'A+'
elif 90<=n:return'A'
elif 87<=n:return 'B+'
elif 80<=n:return 'B'
elif 77<=n:return 'C+'
elif 70<=n:return 'C'
elif 67<=n:return 'D+'
elif 60<=n:return 'D'
else:return 'F'
for _ in range(int(input())):
a,b=input().split()
print(a,get_grade(int(b)))
โ 25933 Medal Ranking โ
for _ in range(int(input())):
ug,us,ub,rg,rs,rb=map(int,input().split())
print(ug,us,ub,rg,rs,rb)
a=0
b=0
if (ug+us+ub)>(rg+rs+rb):a=1
if ug>rg:b=1
elif ug==rg:
if us>rs:b=1
elif us==rs:
if ub>rb:
b=1
if (a,b)==(1,1):print('both')
elif a==1:print('count')
elif b==1:print('color')
else:print('none')
print()
โ 6825 Body Mass Index โ
w=float(input())
h=float(input())
BMI=w/(h*h)
print('Overweight' if BMI>25 else 'Normal weight' if BMI >=18.5 else 'Underweight')
โ 26767 Hurra! โ
n=int(input())
for i in range(1,n+1):
if i%7==0 and i%11==0: print('Wiwat!')
elif i%7==0 and i%11!=0: print('Hurra!')
elif i%7!=0 and i%11==0: print('Super!')
else:print(i)
'BOJ > ๐ฅ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
โ ์ ๋ฐ๋ ์ฐ์ฐ - 1๋ฌธ์ () โ (1) | 2022.10.20 |
---|---|
โ BF Upper-Beginner I - 16 Solvedโ (0) | 2022.10.19 |
โ Math & Geometry Upper-Beginner I - 30 Solvedโ (0) | 2022.10.09 |
โ ์ ๋ ฌ ๊ธฐ์ด1 - 8๋ฌธ์ ()โ (2) | 2022.10.05 |
โ Recursion Upper-Beginner - 3 Solvedโ (0) | 2022.09.27 |
๋๊ธ