백준 2822번 파이썬 a=[] c=[] d=[] for _ in range(8): x= int(input()) a.append(x) d.append(x) temp=a temp.sort(reverse=True) b=temp[:5] print(sum(b)) for i,v in enumerate(d): if v in b: c.append(i+1) c.sort() print(*c) 백준 풀이 2022.08.27
백준 10867번 파이썬 n=int(input()) a=list(set(list(map(int,input().split())))) a.sort() print(*a) 백준 풀이 2022.08.27
백준 2740번 파이썬 a=[] b=[] n,m=map(int,input().split()) for _ in range(n): a.append(list(map(int, input().split()))) m,k=map(int,input().split()) for r in range(m): b.append(list(map(int, input().split()))) c=[[0]*k for x in range(n)] for i in range(n): for j in range(k): for o in range(m): c[i][j]+=a[i][o]*b[o][j] for p in range(n): for q in range(k): print(c[p][q], end=" ") print() 백준 풀이 2022.08.27
백준 11728번 파이썬 a,b=map(int,input().split()) m=list(map(int,input().split())) n=list(map(int,input().split())) m.extend(n) m.sort() print(*m) 백준 풀이 2022.08.26
백준 11004번 파이썬 n,k = map(int,input().split()) a= list(map(int, input().split())) a.sort() print(a[k-1]) 백준 풀이 2022.08.26
백준 1475번 파이썬 a= input() arr=[0]*(10) for i in a: arr[int(i)]+=1 arr[6]=(arr[6]+arr[9])//2 if (arr[6]+arr[9])%2==0 else (arr[6]+arr[9])//2+1 arr[9]=0 print(max(arr)) 백준 풀이 2022.08.26
백준 1010번 파이썬 # from itertools import combinations # n=int(input()) # for _ in range(n): # arr=[] # a,b=map(int,input().split()) # for i in range(b): # arr.append(i) # arr2 = combinations(arr,a) # print(len(list(arr2))) #시간초과 from math import factorial n=int(input()) for _ in range(n): p,q=map(int,input().split()) res= factorial(q)//(factorial(p)*factorial(q-p)) print(res) 백준 풀이 2022.08.26
백준 11723번 파이썬 import sys n=int(sys.stdin.readline()) s= set() for _ in range(n): a=sys.stdin.readline().split() if len(a)==1: if a[0]=="all": s=set([x for x in range(1,21)]) else: s=set() else: p=a[0] q=a[1] q=int(q) if p =="add": s.append(q) #s.add(q) elif p == "remove": s.discard(q) elif p == "check": print(1 if q in a else 0) elif p == "toggle": if q in s: s.discard(q) else: s.add(q) 백준 풀이 2022.08.26