![[백준 알고리즘] 2446번 별 찍기 - 9 (Python)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FrVpzL%2FbtqCJmG11Vv%2FAAAAAAAAAAAAAAAAAAAAAIySdck78lI2H78ByldWDoHd8uolTDda-irmhnRUuTul%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3Db%252B2mHzF8s163o74IUpfFVdwQ5DM%253D)
N = int(input()) for i in reversed(range(1, N+1)): print(' ' * (N - i) + "*" * (2 * i-1)) for i in range(2, N+1): print(' ' * (N - i) + "*" * (2 * i - 1)) ▼ 링크 https://www.acmicpc.net/problem/2446 2446번: 별 찍기 - 9 첫째 줄부터 2×N-1번째 줄까지 차례대로 별을 출력한다. www.acmicpc.net
![[백준 알고리즘] 2523번 별 찍기 - 13 (Python, Java)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FbdgWCJ%2FbtqCLLTqRqd%2FAAAAAAAAAAAAAAAAAAAAAGmPjGFQBTxz6SOia6LTpeCPHcczbs6yIcrHIm0q-R4v%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DveFH7nM6DUQ%252FDcrqJ86moGv3zFA%253D)
N = int(input()) for i in range(1, N+1): print("*"*i) for i in reversed(range(N)): print("*"*i) import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); for(int i=1; i
![[백준 알고리즘] 10039번 평균 점수 (Python, Java)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2Fbw6q1s%2FbtqCNGjAPt7%2FAAAAAAAAAAAAAAAAAAAAADYCgZVsj4EqmFuQytBpsXyFQgX18Ro-ZVyOH2OISC8_%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DvS15GPK3FL507X7zaH%252FfBW2XJ1Q%253D)
sum = 0 for _ in range(5): score = int(input()) if score < 40: score = 40 sum += score print(int(sum/5)) import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int sum = 0; for( int i=0; i
![[백준 알고리즘] 14681번 사분면 고르기 (Python, Java)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FpewJj%2FbtqCLcRkTj7%2FAAAAAAAAAAAAAAAAAAAAAJos_agoEJJS-2G2biz0Z-rg4djKVHlF_tPToK9qs7ht%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DS%252BVXwQLOKlyPjF7pWsV2sOA%252FwW4%253D)
x = int(input()) y = int(input()) if x>0 and y>0: print(1) elif x0: print(2) elif x0) System.out.println(1); else if (x0) System.out.println(2); else if (x
![[백준 알고리즘] 7568번 덩치 (Python)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2Ft4vyr%2FbtqCF8aT4kB%2FAAAAAAAAAAAAAAAAAAAAAM52UNLs9OC5CqlivDabnsU0HnRUrFS6zdqB_muQXdJo%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DHB0QlK5Rb%252FBvhXonPExIBYoGtPI%253D)
N = int(input()) people = [] score = [1 for _ in range(N)] for _ in range(N): x_y = list(map(int, input().split())) people.append(x_y) for i in people: cnt = 1 for j in people: if i[0] < j[0] and i[1] < j[1]: cnt+=1 print(cnt, end=" ") ▼링크 https://www.acmicpc.net/problem/7568 7568번: 덩치 우리는 사람의 덩치를 키와 몸무게, 이 두 개의 값으로 표현하여 그 등수를 매겨보려고 한다. 어떤 사람의 몸무게가 x kg이고 키가 y cm라면 이 사람의 덩치는 (x,y)로 표시된다. 두 사람 A ..
![[백준 알고리즘] 2231번 분해합 (Python)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FbFOyQ7%2FbtqCJmsqzR1%2FAAAAAAAAAAAAAAAAAAAAAC-AojqC4fiFCKN2h3qZaaj57HWo885ZhVuIaxDx847u%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DNs6VuJMmbc6qWC%252BzpwD93UjfjwQ%253D)
N = int(input()) for num in range(1, N+1): num_list = list(map(int, str(num))) num_sum = num + sum(num_list) if num_sum == N: print(num) break if num==N: print(0) ▼ 링크 https://www.acmicpc.net/problem/2231 2231번: 분해합 문제 어떤 자연수 N이 있을 때, 그 자연수 N의 분해합은 N과 N을 이루는 각 자리수의 합을 의미한다. 어떤 자연수 M의 분해합이 N인 경우, M을 N의 생성자라 한다. 예를 들어, 245의 분해합은 256(=245+2+4+5)이 된다. 따라서 245는 256의 생성자가 된다. 물론, 어떤 자연수의 경우에는 생성자가 없을 ..
![[백준 알고리즘] 2798번 블랙잭 (Python)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FT6ezj%2FbtqCJmspL2h%2FAAAAAAAAAAAAAAAAAAAAAKo79UIG_pkTNymAVvue5PbcyyspjWeJ1O44MDrqJ5H6%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DCznCCO6u2wyRHXL8FKky8qCHJl8%253D)
import itertools N, M = map(int, input().split()) card = list(map(int, input().split())) ans = 0 for i in itertools.combinations(card, 3): card_sum = sum(i) if ans < card_sum and card_sum
![[백준 알고리즘] 2775번 부녀회장이 될테야 (Python)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2F627BI%2FbtqCJlz9gsj%2FAAAAAAAAAAAAAAAAAAAAAMpVEIe1Bj5RjzIKd8SZlNsMZQ5PkWC5RiV9yfVUCpbs%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DpSt2TqCvOE1gEjP21gNjecwjdbU%253D)
T = int(input()) for _ in range(T): floor = [] k = int(input()) n = int(input()) floor = [i for i in range(1, n+1)] for i in range(k): for j in range(1, n): floor[j] += floor[j-1] print(floor[-1]) ▼ 링크 https://www.acmicpc.net/problem/2775 2775번: 부녀회장이 될테야 첫 번째 줄에 Test case의 수 T가 주어진다. 그리고 각각의 케이스마다 입력으로 첫 번째 줄에 정수 k, 두 번째 줄에 정수 n이 주어진다. (1
![[백준 알고리즘] 1974번 스택 수열 (Python)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2Fbe8MOu%2FbtqCFxnHx2d%2FAAAAAAAAAAAAAAAAAAAAAFQr67amhLFVzKiVmrwmGeur4nLs-jZG6e_s1U7nmD4_%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3D7BiknO7cjfyn1kTCCSaMJ%252Fcpixs%253D)
N = int(input()) stack = [] check = 1 answer = [] possibility = True for i in range(N): num = int(input()) while check
![[백준 알고리즘] 4949번 균형잡힌 세상 (Python)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2Fdypcdu%2FbtqCGQNNf27%2FAAAAAAAAAAAAAAAAAAAAAD_ru5gnsRoaX6Mnbfu9mKoi2ZhVI6H8CzYbiIS5BF6J%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DAHgqWLDq7359Wm7HzXRcyziO%252BXc%253D)
while True: line = input() if line == ".": break stack = [] check = True for ch in line: if ch == "(" or ch == "[": stack.append(ch) elif ch == ")": if len(stack) == 0: check = False break if stack[-1] == "(": stack.pop() else: check = False break elif ch == "]": if len(stack) == 0: check = False break if stack[-1] == "[": stack.pop() else: check = False break if check and len(stack)==0: print("..