๋ฐ์ํ
3. for๋ฌธ - A+B -7
๋ฌธ์ ) ๋ ์ ์ A์ B๋ฅผ ์ ๋ ฅ๋ฐ์ ๋ค์, A+B๋ฅผ ์ถ๋ ฅํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค.
์ ๋ ฅ | ์ถ๋ ฅ |
5 1 1 2 3 3 4 9 8 5 2 |
Case #1: 2 Case #2: 5 Case #3: 7 Case #4: 17 Case #5: 7 |
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 1; i <= n; i++) {
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println("Case #" + i + ": " + (a + b));
}
}
}
๋ฐ์ํ
'Algorithm > ๋ฐฑ์ค ์๊ณ ๋ฆฌ์ฆ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค ์๊ณ ๋ฆฌ์ฆ] 2438๋ฒ - ๋ณ ์ฐ๊ธฐ - 1 (0) | 2021.01.31 |
---|---|
[๋ฐฑ์ค ์๊ณ ๋ฆฌ์ฆ] 11022๋ฒ - A+B - 8 (0) | 2021.01.31 |
[๋ฐฑ์ค ์๊ณ ๋ฆฌ์ฆ] 2742๋ฒ - ๊ธฐ์ฐ N (0) | 2021.01.31 |
[๋ฐฑ์ค ์๊ณ ๋ฆฌ์ฆ] 2741๋ฒ - N ์ฐ๊ธฐ (0) | 2021.01.31 |
[๋ฐฑ์ค ์๊ณ ๋ฆฌ์ฆ] 15552๋ฒ - ๋น ๋ฅธ A+B (0) | 2021.01.31 |
๋๊ธ