BOJ/๐Ÿฅ‰

โ˜…Implementation Beginner II - 50 Solvedโ˜…

metamong 2022. 10. 10.

โ˜… 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)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

๋Œ“๊ธ€