슈콩

[SWEA] 1차원 정원 본문

Algorithms/SWEA

[SWEA] 1차원 정원

shukong 2025. 11. 12. 20:10

 

 

[문제]

https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AX_N3oSqcyUDFARi

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

 

 

[소스 코드]

import java.io.*;
import java.util.*;
public class Solution {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;
		int T = Integer.parseInt(br.readLine());
		for(int tc=1;tc<=T;tc++) {
			st = new StringTokenizer(br.readLine());
			int n = Integer.parseInt(st.nextToken());
			int d = Integer.parseInt(st.nextToken());
			int result = n / (d*2+1);
			if(n%(d*2+1) != 0) result++;
			System.out.println("#"+tc+" "+result);
		}
	}
}

'Algorithms > SWEA' 카테고리의 다른 글

[SWEA] 상원이의 연속 합  (0) 2025.11.12
[SWEA] 전봇대  (0) 2025.11.12
[SWEA] 한빈이와 Spot Mart  (0) 2025.11.12
[SWEA] 퍼펙트 셔플  (0) 2025.11.12
[SWEA] 민석이의 과제 체크하기  (0) 2025.11.12