C#
백준 11021 : A+B - 7
RIsN
2020. 11. 30. 22:50
두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
첫째 줄에 테스트 케이스의 개수 T가 주어진다.
각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. (0 < A, B < 10)
각 테스트 케이스마다 "Case #x: "를 출력한 다음, A+B를 출력한다. 테스트 케이스 번호는 1부터 시작한다.
:: 성공
: 개선점 : 없음
using System;
namespace for01
{
class Program
{
static void Main(string[] args)
{
// :: Input size and Parse
int size = Int32.Parse(Console.ReadLine());
// :: result Array
string[] result = new string[size];
// :: Loop with size
for(int i = 1; i <= size; i++)
{
// :: Input and Parse
string[] input = Console.ReadLine().Split(' ');
int a = Int32.Parse(input[0]);
int b = Int32.Parse(input[1]);
// :: Save Result
result[i - 1] = String.Format("Case #{0}: {1}", i, a + b);
}
// :: Print with "Wn" for Spped
Console.WriteLine(string.Join("\n", result));
}
}
}