공부기록/SWEA

[SWEA] 15941번 원 안의 점

메델 2023. 10. 26. 02:22
import java.util.Scanner;

public class Solution {
	
	public static void main(String[] args){
		
		Scanner kb = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		
		int T = kb.nextInt();
		
		for(int i=1; i<=T; i++) {
			sb.append("#").append(i).append(" ");
			int N = kb.nextInt();
			int count=0;
			for(int x=-N;x<=N;x++) {
				for(int y=-N; y<=N; y++) {
					if((x*x+ y*y)<=N*N) {
						count++;
					}
				}
			}
			sb.append(count).append('\n');
			
		}
		
		System.out.println(sb.toString());


	}

}