C#/백준 알고리즘

2022.01.25 [백준] C# 큰 수 A+B

ian's coding 2022. 1. 25. 17:14
728x90
반응형

 

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

 

10757번: 큰 수 A+B

두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.

www.acmicpc.net

 


풀이

 

BigInteger (큰 정수) 사용하기

https://docs.microsoft.com/ko-kr/dotnet/api/system.numerics.biginteger?view=net-5.0

 

BigInteger 구조체 (System.Numerics)

부호 있는 임의의 큰 정수를 나타냅니다.Represents an arbitrarily large signed integer.

docs.microsoft.com

 

1
2
3
4
5
6
7
8
9
10
using System;
using System.Numerics;
class Program{
    static void Main(){
        string[] s = Console.ReadLine().Split();
        BigInteger a = BigInteger.Parse(s[0]);
        BigInteger b = BigInteger.Parse(s[1]);     
        Console.Write(a+b);
    }
}
cs

 

 

 

 

728x90
반응형