結果

問題 No.1109 調の判定
ユーザー bluemeganebluemegane
提出日時 2020-07-11 16:26:32
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 869 bytes
コンパイル時間 1,415 ms
コンパイル使用メモリ 63,892 KB
実行使用メモリ 25,520 KB
最終ジャッジ日時 2023-08-03 07:16:09
合計ジャッジ時間 6,512 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
21,432 KB
testcase_01 AC 58 ms
23,380 KB
testcase_02 AC 56 ms
21,472 KB
testcase_03 AC 57 ms
21,260 KB
testcase_04 AC 57 ms
23,396 KB
testcase_05 AC 57 ms
21,420 KB
testcase_06 AC 58 ms
21,408 KB
testcase_07 AC 58 ms
21,444 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 56 ms
19,380 KB
testcase_11 AC 57 ms
23,304 KB
testcase_12 AC 56 ms
21,380 KB
testcase_13 AC 59 ms
21,268 KB
testcase_14 AC 60 ms
21,344 KB
testcase_15 AC 59 ms
21,524 KB
testcase_16 AC 58 ms
23,404 KB
testcase_17 AC 58 ms
23,456 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 58 ms
21,372 KB
testcase_24 AC 58 ms
21,352 KB
testcase_25 AC 58 ms
21,260 KB
testcase_26 AC 57 ms
21,336 KB
testcase_27 AC 54 ms
19,232 KB
testcase_28 AC 58 ms
21,396 KB
testcase_29 AC 57 ms
21,360 KB
testcase_30 AC 57 ms
23,308 KB
testcase_31 AC 57 ms
23,408 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 57 ms
21,476 KB
testcase_36 AC 56 ms
21,352 KB
testcase_37 AC 56 ms
23,404 KB
testcase_38 AC 55 ms
21,428 KB
testcase_39 AC 58 ms
21,280 KB
testcase_40 AC 56 ms
21,344 KB
testcase_41 AC 55 ms
21,364 KB
testcase_42 WA -
testcase_43 AC 54 ms
21,272 KB
testcase_44 AC 56 ms
21,484 KB
testcase_45 AC 55 ms
21,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System.Linq;
using System;

public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        getAns(n, a);
    }
    static void getAns(int n, int[] a)
    {
        var count = 0;
        var ansi = 0;
        for (int i = 0; i < n; i++)
        {
            if (check(n, a, i)) { ansi = i; count++; }
        }
        Console.WriteLine(count == 1 ? a[ansi] : -1);
    }
    static bool check(int n, int[] a, int t)
    {
        var c = new int[] { 0, 2, 4, 5, 7, 9, 11 };
        var d = a[t];
        foreach (var x in a)
        {
            var y = x - d;
            if (y < 0) y += 12;
            y %= 12;
            if (!c.Contains(y)) return false;
        }
        return true;
    }
}
0