슈콩

[SWEA] 다트 게임 본문

Algorithms/SWEA

[SWEA] 다트 게임

shukong 2025. 11. 14. 00:26

 

 

[문제]

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

 

SW Expert Academy

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

swexpertacademy.com

 

 

 

[소스 코드]

import java.io.*;
import java.util.*;
public class Solution {
	static int[] r = new int[]{20*20,40*40,60*60,80*80,100*100,120*120,140*140,160*160,180*180,200*200};
	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++) {
			int score = 0;
			int arrow = Integer.parseInt(br.readLine());
			for(int i=0;i<arrow;i++) {
				st = new StringTokenizer(br.readLine());
				int a = Integer.parseInt(st.nextToken());
				int b = Integer.parseInt(st.nextToken());
				for(int j=0;j<10;j++) {
					if(r[j] >= a*a + b*b) {
						score += (10-j);
						break;
					}
				}
			}
			System.out.println("#"+tc+" "+score);
		}
	}
}

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

[SWEA] 삼성시의 버스 노선  (0) 2025.11.14
[SWEA] 태혁이의 사랑은 타이밍  (0) 2025.11.14
[SWEA] 숫자가 같은 배수  (0) 2025.11.13
[SWEA] 상원이의 연속 합  (0) 2025.11.12
[SWEA] 전봇대  (0) 2025.11.12