언어/C#
[C#] 백준 10757번 : 큰 수를 다룰 땐 BigInteger를 활용하자
돌멩이수프
2023. 1. 12. 23:20
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