結果

問題 No.799 赤黒かーどげぇむ
ユーザー mame_shibemame_shibe
提出日時 2019-12-05 03:52:18
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 1,029 bytes
コンパイル時間 2,304 ms
コンパイル使用メモリ 65,936 KB
実行使用メモリ 23,876 KB
最終ジャッジ日時 2023-08-21 22:29:55
合計ジャッジ時間 4,019 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
19,940 KB
testcase_01 AC 63 ms
21,856 KB
testcase_02 AC 64 ms
23,876 KB
testcase_03 AC 64 ms
21,884 KB
testcase_04 AC 63 ms
21,840 KB
testcase_05 AC 66 ms
21,876 KB
testcase_06 AC 66 ms
19,832 KB
testcase_07 AC 65 ms
21,932 KB
testcase_08 AC 63 ms
19,832 KB
testcase_09 AC 64 ms
21,876 KB
testcase_10 AC 63 ms
19,748 KB
testcase_11 AC 64 ms
21,840 KB
testcase_12 AC 63 ms
21,732 KB
testcase_13 AC 63 ms
21,804 KB
testcase_14 AC 62 ms
21,872 KB
testcase_15 AC 64 ms
21,744 KB
testcase_16 AC 64 ms
21,932 KB
testcase_17 AC 63 ms
23,820 KB
testcase_18 AC 64 ms
21,856 KB
testcase_19 AC 62 ms
21,748 KB
権限があれば一括ダウンロードができます

ソースコード

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