본문 바로가기

백준1056

백준 2435 기상청 인턴 신현수 1 2 3 4 5 6 7 import sys n,k=map(int ,input().split()) tmp=list(map(int,sys.stdin.readline().split())) mymax=-1*999999 for i in range(len(tmp)-k+1): mymax=max(mymax,sum(tmp[i:i+k])) print(mymax) Colored by Color Scripter cs 2021. 12. 14.
백준 15688 수 정렬하기 5 1 2 3 4 5 6 7 import sys n=int(sys.stdin.readline()) tmp=[] for i in range(n): tmp.append(int(sys.stdin.readline())) for i in sorted(tmp): print(i) cs 2021. 12. 14.
백준 4796 캠핑 1 2 3 4 5 6 7 8 cnt=1 while 1: l,p,v=map(int,input().split()) if l==0 and p==0 and v==0 : break else: ans= (v//p)*l + min(v%p,l) print("Case %d: %d"%(cnt,ans)) cnt+=1 cs 2021. 12. 14.
백준 14467 소가 길을 건너간 이유 1 1 2 3 4 5 6 7 8 9 10 11 12 13 ans=[[] for i in range(10)] n=int(input()) cnt=0 for i in range(n): idx,gil=map(int,input().split()) idx-=1 ans[idx].append(gil) for i in range(10): if len(ans[i])>1: for j in range(len(ans[i])-1): if ans[i][j]!=ans[i][j+1] : cnt+=1 else :pass print(cnt) Colored by Color Scripter cs 2021. 12. 14.
백준 12871 무한 문자열 1 2 3 4 5 6 7 8 9 10 11 # def gcd(x,y): # while (y) : x,y=y, x%y # return x s=input() t=input() lenS=len(s) lenT=len(t) s=s*lenT t=t*lenS if s==t : print(1) else : print(0) cs 2021. 12. 14.
백준 18917 수열과 쿼리 38 1 2 3 4 5 6 7 8 9 10 11 12 13 14 import sys n=int(sys.stdin.readline()) mysum=0 xor=0 for i in range(n): oper=list(map(int,sys.stdin.readline().split())) if oper[0]== 1: mysum+=oper[1] xor = xor^oper[1] elif oper[0]== 2 : mysum-=oper[1] xor=xor^oper[1] elif oper[0] == 3: print((mysum)) elif oper[0] == 4: print(xor) cs 2021. 12. 14.
백준 17176 암호해독기 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 import sys def cyper(n): if n==0 : ans=' ' elif n>=1 and n 2021. 12. 14.
백준 11068 회문인 수 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 def jinsu(a,b): tmp=[] while a>0: tmp.append(a%b) a=a//b tmp=tmp[::-1] return tmp def chk(s): for i in range(len(s)//2): if s[i]!= s[-i-1]: return False return True t=int(input()) for _ in range(t): cnt=False n=int(input()) for i in range(2,65): if chk(jinsu(n, i)): cnt=chk(jinsu(n,i)) break if cnt : print(1) else: print(0) cs B 진수로 바꾸는 함수.. 2021. 12. 9.
백준 16212 정열적인 정렬 1 2 3 4 import sys n=int(sys.stdin.readline()) tmp=list(map(int, sys.stdin.readline().split())) print(*sorted(tmp)) cs 2021. 12. 9.
백준 11170 0의 개수 1 2 3 4 5 6 7 dddt=int(input()) for i in range (t): ans=0 n,m=map(int, input().split()) for j in range(n,m+1): ans+=str(j).count('0') print(ans) cs 2021. 12. 9.
백준 11931 수 정렬하기 4 1 2 3 4 5 6 7 import sys tmp=[] for i in range(int(input())): tmp.append(int(sys.stdin.readline())) tmp.sort(reverse=True) for i in tmp: print(i) cs 2021. 12. 8.
백준 11728 배열 합치기 1 2 3 4 5 n,m=map(int, input().split()) tmp1=list(map(int,input().split())) tmp2=list(map(int,input().split())) tmp1.extend(tmp2) print(*sorted(tmp1)) cs 2021. 12. 8.