본문 바로가기

python-algorithm1422

[백준] 1010 1 2 3 4 5 import math import sys for _ in range(int(sys.stdin.readline())): a,b=map(int,sys.stdin.readline().split()) print(math.factorial(b)//math.factorial(a)//math.factorial(b-a)) cs 2021. 1. 21.
[백준] 11719 1 2 3 4 while 1: try: print(input()) except EOFError: break cs 2021. 1. 21.
[백준] 11050 1 2 3 4 import math import sys a,b=map(int,sys.stdin.readline().split()) print(math.factorial(a)//math.factorial(b)//math.factorial(a-b)) cs 2021. 1. 21.
[백준] 4344 1 2 3 4 5 6 7 import sys for _ in range(int(sys.stdin.readline())): tmp=list(map(int, sys.stdin.readline().split())) cnt=0 for i in range(1,tmp[0]+1): if tmp[i]> sum(tmp[1:])/tmp[0] :cnt+=1 print("{:.3%}".format(cnt/tmp[0])) cs 2021. 1. 21.
[백준] 2839 1 2 3 4 5 6 7 8 9 10 11 n=int (input()) ans=0 while n>=0: if n%5 == 0 : ans+=(n//5) print(ans) break n-=3 ans+=1 else: print(-1) cs 2021. 1. 21.
[백준] 2750 1 2 3 4 5 6 7 8 N = int(input()) a=[] for _ in range(N): a.append(int(input())) a.sort() for _ in range(N): print (a[_]) cs 2021. 1. 21.
[백준] 2748 1 2 3 4 5 6 7 8 n=int(input()) tmp=[0,1,1] if n 2021. 1. 21.
[백준] 1546 1 2 3 4 import sys n=int(sys.stdin.readline()) tmp=list(map(int, sys.stdin.readline().split())) print(sum(tmp)*100/max(tmp) /n) cs 2021. 1. 21.
[백준] 1526 1 2 3 4 5 6 7 8 9 10 n=int(input()) while 1: cnt=0 for i in str(n): if i!="4" and i!="7": cnt=1 n-=1 if cnt==0: print(n) break cs 2021. 1. 21.
[백준] 1459 1 2 3 4 5 6 x,y,w,s=map(int, input().split()) goW=(x+y)*w goS=min(x,y)*s+(x+y-min(x,y)*2)*w if (x+y)%2==0 :goSW=s*max(x,y) else: goSW= s*(max(x,y) -1) +w print(min(goW,goSW,goS)) cs 2021. 1. 21.
[백준] 1453 1 2 3 4 5 6 7 8 pc=[0]*101 n=int(input()) tmp=list(map(int, input().split())) ans=0 for i in tmp: if pc[i]==0: pc[i]=1 else: ans+=1 print(ans) cs 2021. 1. 20.
[백준] 1402 1 2 for _ in range(int(input())): print('yes') cs 2021. 1. 20.