python-algorithm1422 백준 7513 준살 프로그래밍 대회 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 testCase=int(input()) ansList=[] for i in range(testCase): print("Scenario #%d:"%(i+1)) wordCount=int(input()) words=[] for j in range(wordCount): words.append(input()) for j in range(int(input())): tmp=list(map(int, input().split())) ans="" for k in range(1,len(tmp)): ans+=words[tmp[k]] print(ans) print() Colored by Color Scripter cs 2021. 12. 3. 백준 5533 유니크 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 scores=[[],[],[]] n=int(input()) for i in range(n): a,b,c=map(int,input().split()) scores[0].append(a) scores[1].append(b) scores[2].append(c) ans=[] for i in range(n): res=0 for j in range(3): if scores[j].count(scores[j][i])==1 : res+=scores[j][i] ans.append(res) for i in ans: print(i) Colored by Color Scripter cs 2021. 12. 3. 백준 5426 비밀 편지 1 2 3 4 5 6 7 8 9 10 import math n=int(input()) for _ in range(n): tmp="" s=input() arrn=int(math.sqrt(len(s))) for i in range(arrn): for j in range(arrn): tmp+=s[arrn*(j+1)-(i+1)] print(tmp) cs 2021. 12. 3. 백준 2669 직사각형 네개의 합집합의 면적 구하기 1 2 3 4 5 6 7 8 9 10 arr= [[0 for col in range(101)] for row in range(101)] for i in range(4): a,b,c,d=map(int,input().split()) for j in range(a,c): for k in range(b,d): arr[j][k]=1 mysum=0 for i in range(101): mysum+=sum(arr[:][i]) print(mysum) Colored by Color Scripter cs 2021. 12. 3. 백준 10804 카드 역배치 1 2 3 4 5 6 7 tmp=[i+1 for i in range(20)] for i in range(10): a,b=map(int, input().split()) a-=1 b-=1 tmp[a:b+1]=tmp[a:b+1][::-1] print(*tmp) cs python에서 list[::-1]를 이용해서 쉽게 구현가능합니다. https://stackoverflow.com/questions/41430791/python-list-error-1-step-on-1-slice 2021. 12. 3. 백준 9243 파일 완전 삭제 1 2 3 4 5 6 7 8 9 10 11 12 13 14 n=int(input()) flag=n%2 s1=str(input()) s2=str(input()) if flag ==0: if s1!=s2 : print("Deletion failed") else: print("Deletion succeeded") else: tmp='' for i in s1: if i=='1' : tmp+='0' else : tmp+='1' if tmp!=s2: print("Deletion failed") else: print("Deletion succeeded") cs 2021. 12. 3. 백준 9226 도깨비말 1 2 3 4 5 6 7 8 9 10 11 12 13 14 from collections import deque vowel=['a','e','i','o','u'] while 1: s=input() if s=='#' : break tmp=deque() for i in s: tmp.append(i) if vowel not in tmp: print(s+"ay") else: while tmp[0] not in vowel :tmp.rotate(-1) for i in tmp: print(i,end='') print("ay") cs 2021. 12. 3. 백준 8741 이진수 합 1 2 3 4 k=int(input()) n=pow(2,k)-1 mysum=(n+1)*n//2 print(bin(mysum)[2:]) cs 2021. 12. 3. 백준 7600 문자가 몇갤까 1 2 3 4 5 6 7 8 9 while 1: cnt=[0]*26 s=str(input()) if s=='#':break for i in s: if i.isalpha(): i=i.lower() cnt[ord(i)-97]=1 print(sum(cnt)) cs 2021. 12. 3. 백준 10173 니모를 찾아서 1 2 3 4 5 6 7 ㅇwhile 1: s=input() if s=='EOI': break else: s=s.lower() if 'nemo' in s:print("Found") else: print("Missing") cs 2021. 12. 2. 백준 3049 다각형의 대각선 1 2 3 4 import math n=int(input()) if n 2021. 11. 30. 백준 3047 ABC 1 2 3 4 5 6 7 8 9 tmp=list(map(int,input().split())) tmp=sorted(tmp) ans=[] s=input() for i in s: if i=='A': ans.append(tmp[0]) if i == 'B': ans.append(tmp[1]) if i == 'C': ans.append(tmp[2]) print(*ans) cs 2021. 11. 30. 이전 1 ··· 60 61 62 63 64 65 66 ··· 119 다음