From a8e072c3b2deef66ae5fdbb87aa1718086edda02 Mon Sep 17 00:00:00 2001 From: songyc macbook Date: Thu, 13 Nov 2025 23:42:24 +0900 Subject: [PATCH] 20251113 baekjoon --- code_study/Baekjoon/python/17103.py | 22 +++++++++++++++++ code_study/Baekjoon/ts/17404.ts | 37 +++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 code_study/Baekjoon/python/17103.py create mode 100644 code_study/Baekjoon/ts/17404.ts diff --git a/code_study/Baekjoon/python/17103.py b/code_study/Baekjoon/python/17103.py new file mode 100644 index 0000000..acbcded --- /dev/null +++ b/code_study/Baekjoon/python/17103.py @@ -0,0 +1,22 @@ +import sys +input = sys.stdin.readline + +nums = [int(input()) for _ in range(int(input()))] +num_max = max(nums) + +isPrime = [True for _ in range(num_max+1)] +isPrime[0], isPrime[1] = False, False +for i in range(2,int(num_max**0.5)+1) : + if isPrime[i] : + for j in range(i*i, num_max+1, i) : + isPrime[j] = False + +result = [] +for n in nums : + count = 0 + for i in range(2,n//2 + 1) : + if isPrime[n-i] and isPrime[i] : + count += 1 + result.append(str(count)) + +print('\n'.join(result)) \ No newline at end of file diff --git a/code_study/Baekjoon/ts/17404.ts b/code_study/Baekjoon/ts/17404.ts new file mode 100644 index 0000000..119ac70 --- /dev/null +++ b/code_study/Baekjoon/ts/17404.ts @@ -0,0 +1,37 @@ +export {}; +const input = require("fs").readFileSync(0).toString().trim().split("\n"); +const N = Number(input[0]); + +let R: number[] = []; +let G: number[] = []; +let B: number[] = []; + +input.slice(1).forEach(line => { + const [r,g,b]: number[] = line.split(" ").map(Number); + R.push(r); + G.push(g); + B.push(b); +}); + +const min = (a: number,b: number): number => Math.min(a,b); +let result: number[] = []; + +for(let i=0; i<3; i++) { + let prevR = i!=0 ? 1000 : R[0]; + let prevG = i!=1 ? 1000 : G[0]; + let prevB = i!=2 ? 1000 : B[0]; + + for(let i=1; i