[백준/Java] 11022 : A+B - 8

SEOP·2023년 5월 16일
0
post-custom-banner

import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

        int T = Integer.parseInt(br.readLine());
        List<Map<String,Integer>> list = new ArrayList();

        for(int i = 0 ; i < T ; i++){
            Map<String,Integer> map = new HashMap<>();
            String[] STR = br.readLine().split(" ");
            int a = Integer.parseInt(STR[0]);
            int b = Integer.parseInt(STR[1]);
            map.put("first",a);
            map.put("second",b);
            map.put("result",a+b);
            list.add(map);
        }

        for(int j = 0 ; j < list.size() ; j++){
            bw.write("Case #"+(j+1)+": ");
            bw.write(String.valueOf(list.get(j).get("first")));
            bw.write(" + ");
            bw.write(String.valueOf(list.get(j).get("second")));
            bw.write(" = ");
            bw.write(String.valueOf(list.get(j).get("result")));
            bw.newLine();
        }
        bw.flush();
        bw.close();
    }
}
profile
응애 나 애기 개발자
post-custom-banner

0개의 댓글