백준 10952번 문제

A+B계산값을 표시하는건데 0 0 입력되면 멈춰야함.



예제 입력

1 1
2 3
3 4
9 8
5 2
0 0


예제 출력

2
5
7
17
7
나는 이렇게 적었는데

import java.util.ArrayList;

import java.util.Scanner;



public class Main {



    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);

        ArrayList<Integer> a = new ArrayList<Integer>();

        ArrayList<Integer> b = new ArrayList<Integer>();

        while(true) {

           int i=0;

           i++;

            a.add(sc.nextInt());

            b.add(sc.nextInt());

            if(a.get(i)+b.get(i)==0) {              

                for(int j =0; j<i+1; j++) {

                    System.out.println(a.get(j)+b.get(j));

                }

                break;

            }

            }

        }      

    }

대체 뭐가문제야..?

- dc official App