結果

問題 No.799 赤黒かーどげぇむ
ユーザー mame_shibe
提出日時 2019-12-05 03:52:18
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 1,029 bytes
コンパイル時間 1,104 ms
コンパイル使用メモリ 104,960 KB
実行使用メモリ 19,328 KB
最終ジャッジ日時 2024-12-15 14:13:04
合計ジャッジ時間 2,910 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters;
using static System.Console;
using static System.Math;

namespace YukiCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve();
        }

        public void Solve()
        {
            int[] A = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            int a, b, c, d;
            a = A[0];
            b = A[1];
            c = A[2];
            d = A[3];

            List<int> red = new List<int>(b-a+1);
            List<int> black = new List<int>(d-c+1);
            for (int i = A[0]; i <= A[1]; i++)
            {
                red.Add(i);
            }

            for (int i = A[2]; i <= A[3]; i++)
            {
                black.Add(i);
            }

            WriteLine((b -a + 1) * (d - c + 1) - red.Intersect<int>(black).Count());



        }
    }
}
0