Swea 3233

문제 보러가기

제한사항

이외의 제한사항은 없다.

첫번째 생각

한 변이 나누어지는 갯수를 구해 나누어지는 정삼각형의 갯수를 구할 수 있다.

(A/B * A/B) 공식을 통해 정답을 도출한다.

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
import java.util.Scanner;

public class Solution {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		for(int tc=1; tc<=T; tc++) {
			int A = sc.nextInt();
			int B = sc.nextInt();
			System.out.println("#"+tc+" "+(long)(A/B)*(A/B));
		}
	}
}