본문 바로가기

python-algorithm1422

[백준] 19946 1 2 3 4 5 6 ans=2**64-int(input()) cnt=0 while ans!=1: ans//=2 cnt+=1 print(64-cnt) cs 2021. 1. 20.
[백준] 19945 1 2 3 4 n=int(input()) if n>0:print(len(bin(n))-2) elif n==0 : print(1) else: print(32) cs 2021. 1. 19.
[백준] 19843 1 2 3 4 5 6 7 8 9 t,n=map(int,input().split()) days=["Mon","Tue","Wed","Thu","Fri"] for _ in range(n): tmp=list(input().split()) if tmp[0]==tmp[2]: t-= int (tmp[3])- int(tmp[1]) else: t-= 24*(days.index(tmp[2])-days.index(tmp[0]))+int(tmp[3])-int(tmp[1]) if t>48: print(-1) elif t>0:print(t) elif t>-49 : print(0) Colored by Color Scripter cs 2021. 1. 19.
[백준] 19563 1 2 3 4 5 6 7 8 a,b,c=map(int,input().split()) a=abs(a) b=abs(b) if a+b 2021. 1. 19.
[백준] 19532 1 2 3 4 a,b,c,d,e,f=map(int,input().split()) for x in range(-999,1000): for y in range(-999,1000): if a*x+b*y==c and d*x+e*y==f :print(x,y) ;break cs 2021. 1. 19.
[백준] 18795 1 2 3 import sys n,m=map(int, input().split()) print(sum(list(map(int,sys.stdin.readline().split() )))+sum(list(map(int,sys.stdin.readline().split() )))) cs 2021. 1. 19.
[백준] 18406 1 2 3 4 5 tmp=input() if sum(map(int, str(tmp[:len(tmp)//2]))) == sum(map(int, str(tmp[len(tmp)//2:]))): print("LUCKY") else: print("READY") Colored by Color Scripter cs 2021. 1. 19.
[백준] 18312 1 2 3 4 5 6 7 8 9 hh=0 ;mm=0 ;ss=0 cnt=0 n,k=map(int, input().split()) while 1: if str(k) in str(hh).zfill(2) or str(k) in str(mm).zfill(2) or str(k) in str(ss).zfill(2):cnt+=1 if hh == n and mm == 59 and ss == 59: print(cnt);break ss+=1 if ss==60 : mm+=1; ss-=60 if mm==60 : hh+=1; mm-=60 Colored by Color Scripter cs 2021. 1. 19.
[백준] 18245 1 2 3 4 5 6 7 8 9 cnt = 1 while 1: s=input() if s=='Was it a cat I saw?': break else: for i in range(0,len(s),cnt+1): print(s[i],end='') cnt+=1 print() cs 2021. 1. 19.
[백준] 18238 1 2 3 4 5 6 ans=0 current=0 for i in input(): if abs(ord(i)-65-current)>12: ans+=26-abs(ord(i)-65-current); current=ord(i)-65 else: ans+=abs(ord(i)-65-current); current=ord(i)-65 print(ans) Colored by Color Scripter cs 2021. 1. 19.
[백준] 18228 1 2 3 4 import sys n=int(input()) pg=list(map(int,sys.stdin.readline().split())) print(min (pg[ :pg.index(-1)])+min(pg[pg.index(-1)+1:])) cs 2021. 1. 19.
[백준] 17950 1 2 3 4 5 6 7 8 9 10 11 import sys h,x=map(int,sys.stdin.readline().split()) r=1000000007 ans=0 cnt=1 for _ in range(h): cnt*=x cnt %= r ans+= int(sys.stdin.readline())*cnt ans%=r print(ans) Colored by Color Scripter cs 2021. 1. 19.