結果

問題 No.358 も~っと!門松列
ユーザー huffman56huffman56
提出日時 2022-11-06 15:27:48
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 1,000 ms
コード長 1,087 bytes
コンパイル時間 2,092 ms
コンパイル使用メモリ 105,484 KB
実行使用メモリ 23,992 KB
最終ジャッジ日時 2023-09-27 10:34:44
合計ジャッジ時間 4,616 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
21,840 KB
testcase_01 AC 61 ms
21,844 KB
testcase_02 AC 61 ms
21,920 KB
testcase_03 AC 62 ms
21,920 KB
testcase_04 AC 64 ms
23,880 KB
testcase_05 AC 62 ms
21,936 KB
testcase_06 AC 61 ms
21,800 KB
testcase_07 AC 62 ms
23,992 KB
testcase_08 AC 64 ms
23,868 KB
testcase_09 AC 62 ms
21,716 KB
testcase_10 AC 62 ms
21,944 KB
testcase_11 AC 61 ms
23,772 KB
testcase_12 AC 62 ms
21,920 KB
testcase_13 AC 61 ms
21,984 KB
testcase_14 AC 61 ms
21,784 KB
testcase_15 AC 60 ms
21,808 KB
testcase_16 AC 61 ms
21,936 KB
testcase_17 AC 61 ms
21,872 KB
testcase_18 AC 61 ms
21,960 KB
testcase_19 AC 60 ms
23,832 KB
testcase_20 AC 63 ms
23,896 KB
testcase_21 AC 60 ms
21,848 KB
testcase_22 AC 62 ms
23,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Collections.Generic;
using System.Linq;
using System.Numerics;
using static System.Math;

namespace SortItems
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var a1 = n[0];
            var a2 = n[1];
            var a3 = n[2];
            var aMax = n.Max();
            var aMin = n.Min();
            var d = new Dictionary<int, int>();
            var cnt = 0;

            if ((a1 != a2 && a1 != a3 && a2 != a3) && (a2 == aMin || a2 == aMax))
            {
                Console.WriteLine("INF");
                return;
            }

            for (var i = 1; i <= aMax; i++)
            {

                if (a1 % i != a3 % i)
                {
                    if ((a1 % i < a2 % i && a2 % i > a3 % i) ||
                      (a1 % i > a2 % i && a2 % i < a3 % i))
                    {
                        cnt++;
                    }
                }

            }

            Console.WriteLine(cnt);
        }
    }
}
0