백준 temp

심재운·2025년 7월 28일
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String input;
		int sum = 0;

		while ((input = br.readLine()) != null) {
			if (input.equals("-1")) {
				break;
			}

			sum += Integer.parseInt(input);
		}

		sb.append(sum);
		System.out.println(sb);
	}
}

Bronze IV #23795 사장님 도박은 재미로 하셔야 합니다

profile
공부는 비효율적으로 하는 게 가장 효율적이다.

0개의 댓글