백준 15552

Hyerin·2021년 12월 5일
0
post-thumbnail

문제

https://www.acmicpc.net/problem/15552

C# 풀이

using System;
using System.IO;

namespace baekjoon
{
    class Program
    {
        static void Main(string[] args)
        {
            // 표준 입출력 스트림 reader,writer 만들기,
            // 테스트케이스 입력 받고, int로 바꾸기, 테스트케이스 개수만큼 입력받기
            // 입력받은 값 분리하기, int로 바꾸기, 서로 더하기, 저장
            // 한 번에 버퍼 비우기

            StreamReader sr = new StreamReader(Console.OpenStandardInput());
            StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());

            string strTestCase = sr.ReadLine();
            int nTestCase = int.Parse(strTestCase);

            for (int i = 0; i < nTestCase; i++)
            {
                string strInput = sr.ReadLine();
                string[] strNum = strInput.Split(' ');
                int nNumA = int.Parse(strNum[0]);
                int nNumB = int.Parse(strNum[1]);
                sw.WriteLine(nNumA + nNumB);
            }
            sw.Flush();
            sw.Close();
            sr.Close();
        }
    }
}

0개의 댓글