結果

問題 No.1717 Levi-Civita Triangle
ユーザー bluemegane
提出日時 2021-11-04 14:46:16
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 766 bytes
コンパイル時間 2,217 ms
コンパイル使用メモリ 107,080 KB
実行使用メモリ 42,088 KB
最終ジャッジ日時 2024-10-14 12:55:38
合計ジャッジ時間 6,359 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 27 WA * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class hello
{
    public static int[] a;
    public static int n;
    static void Main()
    {
        n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
         a = Array.ConvertAll(line, int.Parse);
        getAns();
    }
    static int  getNext ( int p , int pre )
    {
        var t = pre * 100 + a[p] * 10 + a[p + 1];
        if (t == 12 | t == 120 | t == 201) return 1;
        else if (t == 21 | t == 102 | t == 210) return 2;
        return 0;
    }
    static void getAns ()
    {
        var pre = getNext(1, a[0]);
        for (int i = 1; i < n; i++)
        {
            var w = getNext(2 * i + 1, pre);
            pre = w;
        }
        Console.WriteLine(pre);
    }
}
0