카테고리 없음
C#) [BOJ] 10822 더하기
HSH12345
2023. 1. 20. 14:41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace _230120_1
{
class Program
{
static void Main(string[] args)
{
StreamReader sr = new StreamReader(Console.OpenStandardInput());
StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());
StringBuilder sb = new StringBuilder();
sb.Append(sr.ReadLine());
string[] str = sb.ToString().Split(',');
int sum = 0;
for(int i = 0; i < str.Length; i++)
{
sum += int.Parse(str[i]);
}
sw.WriteLine(sum);
sr.Close();
sw.Flush();
sw.Close();
}
}
}
정답..