From 5e3f398fa0ebdb11aaa7ac5d534afe66e2ad4921 Mon Sep 17 00:00:00 2001 From: SSUM <116950962+ssum21@users.noreply.github.com> Date: Mon, 30 Mar 2026 16:07:11 +0900 Subject: [PATCH] =?UTF-8?q?[Gold=20IV]=20Title:=20=EC=A2=8B=EB=8B=A4,=20Ti?= =?UTF-8?q?me:=20676=20ms,=20Memory:=2040724=20KB=20-BaekjoonHub?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 백준/Gold/1253. 좋다/README.md | 32 ++++++++++++++++++++++++++++ 백준/Gold/1253. 좋다/좋다.py | 38 ++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 백준/Gold/1253. 좋다/README.md create mode 100644 백준/Gold/1253. 좋다/좋다.py diff --git a/백준/Gold/1253. 좋다/README.md b/백준/Gold/1253. 좋다/README.md new file mode 100644 index 0000000..bb65a43 --- /dev/null +++ b/백준/Gold/1253. 좋다/README.md @@ -0,0 +1,32 @@ +# [Gold IV] 좋다 - 1253 + +[문제 링크](https://www.acmicpc.net/problem/1253) + +### 성능 요약 + +메모리: 40724 KB, 시간: 676 ms + +### 분류 + +자료 구조, 정렬, 이분 탐색, 두 포인터 + +### 제출 일자 + +2026년 3월 30일 16:06:57 + +### 문제 설명 + +

N개의 수 중에서 어떤 수가 다른 수 두 개의 합으로 나타낼 수 있다면 그 수를 “좋다(GOOD)”고 한다.

+ +

N개의 수가 주어지면 그 중에서 좋은 수의 개수는 몇 개인지 출력하라.

+ +

수의 위치가 다르면 값이 같아도 다른 수이다.

+ +### 입력 + +

첫째 줄에는 수의 개수 N(1 ≤ N ≤ 2,000), 두 번째 줄에는 i번째 수를 나타내는 Ai가 N개 주어진다. (|Ai| ≤ 1,000,000,000, Ai는 정수)

+ +### 출력 + +

좋은 수의 개수를 첫 번째 줄에 출력한다.

+ diff --git a/백준/Gold/1253. 좋다/좋다.py b/백준/Gold/1253. 좋다/좋다.py new file mode 100644 index 0000000..53117dd --- /dev/null +++ b/백준/Gold/1253. 좋다/좋다.py @@ -0,0 +1,38 @@ +import sys +from collections import defaultdict, deque, Counter +from heapq import heappush, heappop, heapify +from itertools import permutations, combinations +from functools import lru_cache +from typing import List, Optional + +def solve(): + # 입력 처리 + n = int(input()) + arr = list(map(int, input().split())) + # 풀이 작성 + arr.sort() + total = 0 + if(n==1 or n==2): + print(total) + else: + for i in range(n): + left = 0 + right = n-1 + goal = arr[i] + while (leftgoal): + right-=1 + else: + left+=1 + print(total) + +if __name__ == "__main__": + solve()