본문 바로가기

백준1056

백준 3004 체스판 조각 1 2 3 4 n=int(input()) if n%2==0: a1,a2=n//2,n//2 else : a1,a2=n//2+1,n//2 print((a1+1)*(a2+1) ) cs 2022. 1. 9.
백준 24086 身長 (Height) 1 print( abs(int(input())-int(input()))) cs 2022. 1. 9.
백준 24082 立方体 (Cube) 1 print(int(input())**3) cs 2022. 1. 9.
백준 24078 余り (Remainder) 1 print(int(input())%21) cs 2022. 1. 9.
백준 23234 The World Responds 1 print("The world says hello!") cs 2022. 1. 9.
백준 23827 수열 (Easy) 1 2 3 4 5 6 7 8 9 10 import sys n=int(input()) nums=list(map(int, sys.stdin.readline().split())) sumNums=sum(nums) ans=0 for i in nums: sumNums-=i ans+=i*sumNums ans%=(10**9+7) print(ans) Colored by Color Scripter cs 2022. 1. 4.
백준 12788 제 2회 IUPC는 잘 개최될 수 있을까? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 n=int(input()) m,k=map(int, input().split()) cntPencil=m*k ctpList=sorted( list(map(int,input().split())) ,reverse=True) start=0 currentPencil=0 flag=0 for i in ctpList: currentPencil+=i start+=1 if currentPencil>= cntPencil: print(start) flag=1 break if flag==0: print("STRESS") Colored by Color Scripter cs 2022. 1. 1.
백준 1235 학생 번호 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 n=int(input()) studentList=[input() for i in range(n)] numberLen=len(studentList[0]) # print(studentList) # print(numberLen) for i in range(1,numberLen+1): compareList=[] for j in range(n): if studentList[j][numberLen-i:numberLen] in compareList: break else: compareList.append(studentList[j][numberLen-i:numberLen]) #print(compareList) if len(compareList)==n.. 2022. 1. 1.
백준 13171 A 1 2 3 4 5 6 7 8 9 10 11 12 13 14 a=int(input()) x=int(input()) ans=1 xtobin=bin(x)[2:][::-1] tmp=[] for i in range(65): tmp.append(a) a=a**2 a%=1000000007 for i in range(len(xtobin)): if int(xtobin[i])==1: ans*=tmp[i] ans%=1000000007 print(ans) cs 2021. 12. 30.
print vs pprint 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 from pprint import pprint sample_json = { "id": "0001", "type": "donut", "name": "Cake", "ppu": 0.55, "batters": { "batter": [ { "id": "1001", "type": "Regular" }, { "id": "1002", "type": "Chocolate" }, { "id": "1003", "type": "Blueberry" }, { "id": "1004", "type": "Devil's Food" } ] }, "topping": [ { "id": "5001", .. 2021. 12. 30.
백준 17952 과제는 끝나지 않아! 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #17952 import sys n=int(input()) assignmentList=[] score=0 for i in range (n): task=list(map(int, sys.stdin.readline().split())) if task[0]==1: assignmentList.append([task[1],task[2]]) if assignmentList: assignmentList[-1][1]-=1 if assignmentList[-1][1]==0: score += assignmentList[-1][0] assignmentList.pop() print(score) Colored by Color Scripter cs 2021. 12. 30.
백준 11899 괄호 끼워넣기 1 2 3 4 5 s=input() n=len(s)//2 for _ in range(n): s=s.replace("()","") print(len(s)) cs replace()함수 사용해서 쉽게 구현했고 Line2에서 2로 나눈 이유는 "()"가 길이를 2만큼 차지해서 굳이 n번만큼 반복안하고 n번의 절반만큼만 반복해도 가능함 2021. 12. 29.