python-algorithm1422 백준 2998 8진수 1 2 3 4 5 6 7 8 9 10 n=str(input()) binary=0 for i in range(len(n)): binary+=pow(2,len(n)-1-i)*int(n[i]) octal="" while binary>0: octal+=str(binary%8) binary=binary//8 octal=octal[::-1] print(octal) cs 2021. 11. 30. 백준 2592 대표값 1 2 3 4 5 6 7 8 9 10 from collections import Counter tmp=[] for i in range(10): tmp.append(int(input())) print(sum(tmp)//10) cnt=Counter(tmp) print(cnt.most_common(1)[0][0]) cs 2021. 11. 30. 백준 20953 고고학자 예린 1 2 3 4 5 import sys n=int(sys.stdin.readline()) for i in range(n): a,b=map(int,sys.stdin.readline().split()) print((a+b)*(a+b)*(a+b-1)//2) cs 스탠다드 인풋 안쓰고 input()쓰시면 통과 안될꺼에요~ 2021. 11. 30. 백준 23756 노브 돌리기 1 2 3 4 5 6 7 8 n=int(input()) start=int(input()) ans=0 for i in range(n): go=int(input()) ans+=min(abs(start-go),360-start+go,start+360-go) start=go print(ans) Colored by Color Scripter cs 1.시작점에서 목적지 까지 바로가는방법 2. 오른쪽으로 한바퀴 감아서 목적지 까지 가는법. 3. 왼쪽으로 한바퀴 감아서 목적지 까지 가는법. 이 3가지 방법중에 가장 작은 각도로 이동하는 방법으로 가는 내용을 구현 2021. 11. 30. 백준 23320 홍익 절대평가 1 2 3 4 5 6 7 n=int(input()) scores=list(map(int,input().split())) x,y=map(int,input().split()) absolute=0 for i in scores: if i>=y: absolute+=1 print((n*x//100),absolute) cs 2021. 11. 30. 백준 23303 이 문제는 D2 입니다. 1 2 3 s=input() if 'd2' in s or 'D2' in s:print('D2') else: print('unrated') cs 2021. 11. 30. 백준 23080 스키테일 암호 1 2 3 4 5 6 n=int(input()) s=input() ans='' for i in range(0,len(s),n): ans+=s[i] print(ans) cs 2021. 11. 30. 백준 23027 1번부터 문제의 상태가…? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 s=input() n=len(s) tmpA='BCDF' tmpB='CDF' tmpC='DF' if 'A' in s: for i in s: if i in tmpA: s=s.replace(i,'A') elif 'B' in s: for i in s: if i in tmpB: s=s.replace(i,'B') elif 'C' in s: for i in s: if i in tmpC: s=s.replace(i,'C') else: s='A'*n print(s) cs 2021. 11. 30. 백준 22966 가장 쉬운 문제를 찾는 문제 1 2 3 4 5 6 n=int(input()) tmp=[] for i in range(n): tmp.append(input().split()) tmp=sorted(tmp,key= lambda x:x[1]) print(tmp[0][0]) cs 2021. 11. 30. 백준 21964 선린인터넷고등학교 교가 1 2 3 n=int(input()) s=input() print(s[-5:-1]+s[n-1]) cs 2021. 11. 30. 백준 21918 전구 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 n,m=map(int,input().split()) bulbs=list(map(int, input().split())) for i in range(m): a,b,c=map(int, input().split()) if a==1: bulbs[b-1]=c elif a==2 : for j in range(b-1,c): if bulbs[j]==1:bulbs[j]=0 else : bulbs[j]=1 elif a==3: for j in range(b-1, c): bulbs[j]=0 elif a==4: for j in range(b-1, c): bulbs[j]=1 print(*bulbs) cs 2021. 11. 30. 백준 21756 지우개 1 2 3 4 5 6 7 8 n=int(input()) mylist=[i+1 for i in range(n)] while len(mylist)>1: for i in range(0,len(mylist),2): mylist[i]=0 while 0 in mylist: mylist.remove(0) print(*mylist) cs 바로 pop이나 remove를 통해서 지워버리면 인덱스 순서가 꼬여서 0으로 바꾸고 0인 인덱스를 찾아서 remove 해서 구현함 2021. 11. 30. 이전 1 ··· 61 62 63 64 65 66 67 ··· 119 다음