728x90
<9223372036854775807 + 9223372036854775808를 출력하라.>
백준 10757번문제다. int, long으로는 답을 구할 수 없다. 이땐 BigInteger로 변수를 지정해주면 큰 수를 다룰 수 있다.👍
using System;
using System.Net.Http.Headers;
using System.Numerics;
using System.Text;
class Program
{
static void Main(string[] args)
{
string[] s = Console.ReadLine().Split();
BigInteger a = BigInteger.Parse(s[0]);
BigInteger b = BigInteger.Parse(s[1]);
Console.WriteLine(a + b);
}
}
728x90
'언어 > C#' 카테고리의 다른 글
[C#] 백준 1929번 : 에라토스테네스의 체 방식(빠르게 소수 찾기) (0) | 2023.01.15 |
---|---|
[C#] 백준 2581번 (0) | 2023.01.14 |
[C#] 백준 2839번 (0) | 2023.01.12 |
[C#] 백준 2292번 (0) | 2023.01.10 |
[C#] 백준 1712번 (0) | 2023.01.10 |