結果

問題 No.745 letinopia raoha
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-11-26 21:25:12
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 1,334 bytes
コンパイル時間 1,872 ms
コンパイル使用メモリ 65,760 KB
実行使用メモリ 23,688 KB
最終ジャッジ日時 2023-09-02 00:26:36
合計ジャッジ時間 2,454 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
19,692 KB
testcase_01 AC 56 ms
23,648 KB
testcase_02 AC 59 ms
23,688 KB
testcase_03 AC 59 ms
23,660 KB
testcase_04 AC 57 ms
21,380 KB
testcase_05 AC 59 ms
23,652 KB
testcase_06 AC 60 ms
23,632 KB
testcase_07 AC 60 ms
21,604 KB
testcase_08 AC 60 ms
23,608 KB
testcase_09 AC 58 ms
23,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program {
    static void Main() {
        var score = 0;
        var bonus = 1;

        var pf = NextInt();
        var gt = NextInt();
        var gd = NextInt();
        var ms = NextInt();

        if (ms >= 10) {
            WriteLine("Impossible");
            return;
        }
        foreach (var i in Enumerable.Range(1, int.MaxValue)) {
            if (gt == 0 && pf == 0) {
                break;
            } else if (gt != 0) {
                score += 50 * bonus;
                gt--;
            } else if (pf != 0) {
                score += 100 * bonus;
                pf--;
            }
            if (i % 100 == 0) {
                bonus *= 2;
            }
        }
        WriteLine("Possible\n" + score.ToString());
    }

    static int NextInt() {
        return int.Parse(NextString());
    }

    static string NextString() {
        var result = new List<char>();
        while (true) {
            int next = Read();
            if (next < 0)
                break;
            var nextChar = (char)next;
            if (!char.IsWhiteSpace(nextChar))
                result.Add(nextChar);
            else if (nextChar != '\r')
                break;
        }
        return string.Join("", result);
    }
}
0