백준문제풀이/기본수학17 2839번 -- 설탕배탈(수정필요) import sys import math sys.stdin = open("input.txt","rt") x = int(input()) cnt = 0 if (x % 3 != 0) and (x % 5 != 0): print(-1) if ((x % 5) % 3 == 0): cnt = x // 5 x = x % 5 if x < 3: cnt = x print(cnt) else: x = x // 3 cnt += x print(cnt) elif (x % 3) == 0: x = x//3 cnt = x print(cnt) # 1차 수정 코드 (여전히 답 안맞음) import sys sys.stdin = open("input.txt","rt") x = int(input()) cnt = 0 while True: if (x .. 백준문제풀이/기본수학1 2022. 12. 31. 2775 t = int(input()) for _ in range(t): floor = int(input()) # 층 num = int(input()) # 호 f0 = [x for x in range(1, num+1)] # 0층 리스트 for k in range(floor): # 층 수 만큼 반복 for i in range(1, num): # 1 ~ n-1까지 (인덱스로 사용) f0[i] += f0[i-1] # 층별 각 호실의 사람 수를 변경 print(f0[-1]) # 가장 마지막 수 출력 백준문제풀이/기본수학1 2022. 12. 30. 10250 import sys import math a = int(input()) for i in range(a): height, side, n = map(int, sys.stdin.readline().split()) cnt = 0 up = 1 side = 1 while True: cnt += 1 if len(str(side)) == 1: side = "0" + str(side) else: side = str(side) num = str(up) + side side = int(side) if up%height == 0: up = 0 side += 1 if cnt == n: break up += 1 print(cnt, num) 백준문제풀이/기본수학1 2022. 12. 28. 2869 달팽이는 올라가고 싶다 import sys sys.stdin = open("input.txt","rt") up,down,v = map(int, sys.stdin.readline().split()) total_v = 0 cnt = 0 while True: cnt += 1 total_v += up if total_v >= v: break else: total_v -= down print(cnt) --------------------- # 답 import sys import math sys.stdin = open("input.txt","rt") a,b,v = map(int, sys.stdin.readline().split()) total_day = math.ceil((v-b)/(a-b)) print(total_day) 백준문제풀이/기본수학1 2022. 12. 27. 1193 -- 다시풀이 import sys sys.stdin = open("input.txt","rt") a = int(sys.stdin.readline().strip()) x = a cnt = 0 # 분모 1씩 줄고 분자 1씩 늘고 분모가 1이되면 break for i in range(1,a+1): for j in range(1,i+1): bunsu = str(j) + "/" + str(i) cnt += 1 if cnt == a: break print(cnt) print(bunsu) i -= 1 # 시간초과됨 import sys sys.stdin = open("input.txt","rt") a = int(sys.stdin.readline().strip()) cnt = 0 breaker = False ans = [] # 분모 .. 백준문제풀이/기본수학1 2022. 12. 26. 2292 import sys sys.stdin = open("input.txt","rt") a = int(sys.stdin.readline().strip()) x = 1 cnt = 1 for i in range(1, a): if x < a 백준문제풀이/기본수학1 2022. 12. 26. 1712 -- 다시풀어보기 import sys sys.stdin = open("input.txt","rt") a,b,c = map(int, sys.stdin.readline().split()) total_b = 0 original_notebook = 0 total_notebook = a cnt = 0 while True: total_b += b total_notebook = a total_notebook += total_b original_notebook += c if total_notebook >= original_notebook: cnt += 1 elif total_notebook < original_notebook: cnt += 1 break ------------------------- # 시간초과 import sys sy.. 백준문제풀이/기본수학1 2022. 12. 24. 이전 1 다음