백준 7510 java

magicdrill·2024년 9월 20일
0

백준 문제풀이

목록 보기
443/655

백준 7510 java

import java.awt.*;
import java.util.Collections;
import java.util.Scanner;
import java.util.Vector;

public class bj7510 {
    public static void main(String[] args) {

        Vector<Vector<Integer>>  data = new Vector<>();
        data = inputData();
        findAnswer(data);
    }

    public static void findAnswer(Vector<Vector<Integer>> data)
    {
        int i, a, b, c;

        for(i = 0; i < data.size(); i++)
        {
            Collections.sort(data.get(i));
            a = data.get(i).get(0);
            b = data.get(i).get(1);
            c = data.get(i).get(2);
            if(c*c == (a*a) + (b*b))
            {
                System.out.println("Scenario #" + (i + 1) + ":");
                System.out.println("yes");
            }
            else
            {
                System.out.println("Scenario #" + (i + 1) + ":");
                System.out.println("no");
            }
            System.out.println();
        }
    }

    public static Vector<Vector<Integer>>  inputData()
    {
        Scanner scanner = new Scanner(System.in);
        int i, T, a, b, c;

        Vector<Vector<Integer>> data = new Vector<>();
        T = scanner.nextInt();
        for(i = 0; i < T; i++)
        {
            Vector<Integer> temp = new Vector<>();

            a = scanner.nextInt();
            b = scanner.nextInt();
            c = scanner.nextInt();
            temp.add(a);
            temp.add(b);
            temp.add(c);
            data.add(temp);
        }
        scanner.close();

        return data;
    }
}

0개의 댓글