[백준] C# : 사파리 월드 (2420번)

ssu_hyun·2022년 7월 16일
0

Data Structure & Algorithm

목록 보기
31/67
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Baekjoon
{
    class Program
    {
        static void Main(string[] args)
        {
            string [] s = Console.ReadLine().Split();
            long n = long.Parse(s[0]);
            long m = long.Parse(s[1]);
            Console.WriteLine(Math.Abs(n - m));
        }
    }
}
  • -2,000,000,000 ≤ N, M ≤ 2,000,000,000
  • n과 m의 연산은 int의 범위를 벗어나므로 그보다 더 큰 데이터 형식인 long을 사용해야 한다.
    • int : –2,147,483,648 ~ 2,147,483,647
    • long : –9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807

0개의 댓글