python-algorithm1422 [백준] 5789 1 2 3 4 5 import sys for _ in range(int(sys.stdin.readline())): s=sys.stdin.readline() if s[len(s)//2] == s[len(s)//2 -1]: print("Do-it") else: print("Do-it-Not") cs 2021. 1. 10. [백준] 5724 1 2 3 4 5 6 7 8 9 10 import sys def pinman(n): cnt=0 for i in range(1,n+1): cnt+=pow(i,2) return(cnt) while True: n=int(sys.stdin.readline()) if n==0: exit() else: print(pinman(n)) cs 2021. 1. 9. [백준] 5704 1 2 3 4 5 6 7 8 9 10 11 12 13 14 import sys while True: tmp = [0] * 26 try : s=sys.stdin.readline() if s=="*": exit() else: for i in range(len(s)-1): if ord(s[i])!=32 : tmp[ord(s[i])-97]=1 if sum(tmp) ==26: print("Y") else: print("N") except : exit() cs 2021. 1. 9. [백준] 5691 1 2 3 4 5 import sys while True: a,b=map(int, sys.stdin.readline().split()) if a==0 and b==0 :exit() print( min(a,b)- abs(a-b) ) cs 2021. 1. 9. [백준] 5656 1 2 3 4 5 6 7 8 import sys cnt=1 while True: s=sys.stdin.readline() if s[2] =="E" : exit() print ("Case %d: "%cnt,end='') print( str (eval(s))[0].lower()+str (eval(s))[1:]) cnt+=1 Colored by Color Scripter cs 2021. 1. 9. [백준] 5622 1 2 3 4 5 6 7 8 9 10 11 12 13 14 s=input() cnt=0 two="ABC" ;three="DEF";four="GHI";five="JKL";six="MNO";seven="PQRS" eight="TUV";nine="WXYZ" for i in s: if i in two : cnt+=3 if i in three: cnt += 4 if i in four: cnt += 5 if i in five: cnt += 6 if i in six: cnt += 7 if i in seven: cnt += 8 if i in eight: cnt += 9 if i in nine: cnt += 10 print(cnt) Colored by Color Scripter cs 2021. 1. 9. [백준] 5597 1 2 3 4 5 6 tmp=[0]*31 tmp[0]=1 for i in range(28): tmp[int(input())]=1 for i in range(31): if tmp[i]==0 :print(i) cs 2021. 1. 9. [백준] 5586 1 2 3 4 5 6 7 8 9 import sys s=sys.stdin.readline() cnt1=0 cnt2=0 for i in range(len(s)-2): if s[i]=='J' and s[i+1]=='O' and s[i+2]=='I': cnt1+=1 elif s[i] == 'I' and s[i + 1] == 'O' and s[i + 2] == 'I': cnt2 += 1 print(cnt1) print(cnt2) Colored by Color Scripter cs 2021. 1. 9. [백준] 5576 1 2 3 4 5 6 7 8 9 10 import sys teamW=[] teamK=[] for _ in range(10): teamW.append(int(sys.stdin.readline())) for _ in range(10): teamK.append(int(sys.stdin.readline())) teamW.sort(reverse=True) teamK.sort(reverse=True) print(sum(teamW[:3]),sum(teamK[:3])) cs 2021. 1. 9. [백준] 5524 1 2 3 4 import sys for _ in range(int(sys.stdin.readline())): s=sys.stdin.readline() print(s.lower(),end='') cs 내장함수 lower()을 이용해서 소문자로 출력하면됩니당 2021. 1. 9. [백준] 5363 1 2 3 4 5 6 7 8 import sys for _ in range(int(sys.stdin.readline())): tmp=list(sys.stdin.readline().split()) for i in range(2,len(tmp)): print(tmp[i],end=' ') print(tmp[0],end=' ') print(tmp[1],end='') print() Colored by Color Scripter cs 2021. 1. 9. [백준] 5355 1 2 3 4 5 6 7 8 9 import sys for _ in range(int(sys.stdin.readline())): tmp=list(sys.stdin.readline().split()) ans=float(tmp[0]) for i in range(1,len(tmp)): if tmp[i]=='@': ans*=3 elif tmp[i] == '%': ans += 5 elif tmp[i] == '#': ans -= 7 print("%.2f"%ans) cs 2021. 1. 9. 이전 1 ··· 95 96 97 98 99 100 101 ··· 119 다음