๐Ÿ•ธ Algorithm/๐Ÿ•ธ ๋ฐฑ์ค€ BaekJoon

[๋ฐฑ์ค€][java][10950][A+B - 3]

๋‰ด์ด NUEY 2023. 10. 1. 16:59
๋ฐ˜์‘ํ˜•

import java.util.Scanner;
// 10950	A+B - 3
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int num = sc.nextInt();
		
		int[] times = new int[num];
		int[] sum = new int[num];
		
		for (int i=0; i < times.length; i++) {
			sum[i] += sc.nextInt();
			sum[i] += sc.nextInt();
		}
		
		sc.close();
		
		for (int s : sum) 
			System.out.println(s);
	}
}
  • ์ž…๋ ฅ์กฐ๊ฑด์˜ ํ…Œ์ŠคํŠธ์ผ€์ด์Šค ๊ฐฏ์ˆ˜๋ฅผ ๋จผ์ € ์ž…๋ ฅํ•œ๋‹ค๋Š” ์  ์ฃผ์˜
  • int ๊ธฐ๋ณธ๋ฐฐ์—ด๊ณผ for๋ฌธ์„ ์ด์šฉํ•ด์„œ ์‰ฝ๊ฒŒ ํ‘œํ˜„ํ•  ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
๋ฐ˜์‘ํ˜•