結果

問題 No.2681 ゲームセンターの両替
ユーザー bluemeganebluemegane
提出日時 2024-04-09 07:10:16
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 829 bytes
コンパイル時間 6,682 ms
コンパイル使用メモリ 168,116 KB
実行使用メモリ 184,420 KB
最終ジャッジ日時 2024-04-09 07:10:35
合計ジャッジ時間 9,074 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
28,644 KB
testcase_01 AC 48 ms
29,056 KB
testcase_02 AC 41 ms
29,184 KB
testcase_03 AC 44 ms
29,184 KB
testcase_04 WA -
testcase_05 AC 43 ms
29,056 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 42 ms
29,056 KB
testcase_09 WA -
testcase_10 AC 42 ms
29,184 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 41 ms
28,540 KB
testcase_14 AC 41 ms
29,184 KB
testcase_15 AC 42 ms
28,644 KB
testcase_16 AC 41 ms
28,672 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 42 ms
28,800 KB
testcase_21 AC 43 ms
28,800 KB
testcase_22 AC 46 ms
28,668 KB
testcase_23 AC 47 ms
28,672 KB
testcase_24 AC 46 ms
184,420 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (80 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var c = int.Parse(line[0]);
        var y = int.Parse(line[1]);
        getAns(c, y);
    }
    static int[] getArray(int y, int[] t)
    {
        var a = new int[6];
        for (int i = 0; i < 6; i++)
        {
            a[i] = y / t[i];
            y -= a[i] * t[i];
        }
        Array.Reverse(a);
        return a;
    }
    static void getAns(int c, int y)
    {
        var t = new int[] { 10000, 5000, 2000, 1000, 500, 100 };
        if (c * 100 > y) { Console.WriteLine("can't exchange"); return; }
        var a = getArray(y, t);
        if (a[0] + a[1] >= c) { Console.WriteLine("no exchange"); return; }
        c -= a[0];
        Console.WriteLine((c + 4) / 5 * 5);
    }
}
0