結果

問題 No.1992 Tendon Walk
ユーザー bluemegane
提出日時 2022-07-02 07:09:10
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 860 bytes
コンパイル時間 2,453 ms
コンパイル使用メモリ 109,028 KB
実行使用メモリ 17,792 KB
最終ジャッジ日時 2024-11-26 19:16:34
合計ジャッジ時間 2,643 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 now, x, ans;
    static void Main()
    {
         x = int.Parse(Console.ReadLine().Trim());
        getAns();
    }
    static bool aa ()
    {
        ans += 2;
        now += 2;
        return now == x;
    }
    static bool bb()
    {
        ans++;
        now--;
        return now == x;
    }
    static void getAns()
    {
        now = 0;
        while (true)
        {
            if (aa()) { Console.WriteLine(ans);return; }
            if (aa()) { Console.WriteLine(ans); return; }
            if (bb()) { Console.WriteLine(ans); return; }
            if (bb()) { Console.WriteLine(ans); return; }
            if (aa()) { Console.WriteLine(ans); return; }
            if (bb()) { Console.WriteLine(ans); return; }
            if (bb()) { Console.WriteLine(ans); return; }
        }
    }
}
0