선릉역 1번 출구
baekjoon - 기본 수학1 본문
1. 1712
A, B, C = map(int, input().split()) i = 1 if B >= C: print(-1) else: print(A // (C - B) + 1) |
2. 2292
num = int(input()) count = 2 start = 7 while True: if num == 1: count = 1 print(1) break if num/start <= 1: print(count) break start += 6 * count count += 1 |
num = int(input()) nums_bee = 1 count = 1 while num > nums_bee: nums_bee += 6 * count count += 1 print(count) |
3. 1193
num = int(input()) cnt = 1 fract = 1 flag = 1 prev = 0 while num > fract: prev = fract fract += (cnt + 1) cnt += 1 flag = -(flag) key = cnt + 1 key2 = num - prev if flag == 1: print("{}/{}".format((cnt+1)-key2, key2)) else: print("{}/{}".format(key2, (cnt+1)-key2)) |
4. 2869
day, night, height = map(int,input().split()) if (height - day) % (day - night) > 0: print((height - day) // (day - night) + 2) else: print(int((height - day) // (day - night)) + 1) |
5. 10250
for _ in range(int(input())): H, W, N = map(int, input().split()) if N % H == 0: floor = H next = N // H else: floor = N % H next = N // H + 1 print(f"{floor}{next:02}") |
6. 2775
a = int(input()) for i in range(a): floor = int(input()) next = int(input()) ls = [] ls_new = [0] * next for i in range(next): ls.append(i+1) for j in range(floor): for k in range(1, next+1): ls_new[k-1] = sum(ls[:k]) ls = ls_new.copy() print(ls[next-1]) |
#리스트 끼리 =로 해주면 값 복붙이 아니라 참조가 되어버림 copy()를 쓸 것
7. PASS
8. 10757
A,B = map(int, input().split()) print(A+B) |
9. 1011
for _ in range(int(input())): x, y = map(int, input().split()) cnt = 1.5 cnt_num = 2 num = 2 if (y - x) == 1 or (y - x) == 2: print(y - x) else: while num < y - x: cnt += 0.5 num += int(cnt) cnt_num += 1 print(cnt_num) |
for _ in range(int(input())): x, y = map(int, input().split()) cnt = 0.5 cnt_num = 0 num = 0 while num < y - x: cnt += 0.5 num += int(cnt) cnt_num += 1 print(cnt_num) |
#0.5 더하고 int하는 것!
'Algorithm > Algorithm 문제풀이' 카테고리의 다른 글
baekjoon - 브루트 포스 (0) | 2021.08.19 |
---|---|
baekjoon - 기본 수학2 (0) | 2021.08.18 |
baekjoon - 문자열 (0) | 2021.08.17 |
baekjoon - 함수 (0) | 2021.08.17 |
baekjoon - 1차원 배열 (0) | 2021.08.17 |
Comments