結果

問題 No.825 賢いお買い物
ユーザー bluemeganebluemegane
提出日時 2019-05-11 07:13:25
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 943 bytes
コンパイル時間 2,126 ms
コンパイル使用メモリ 96,420 KB
実行使用メモリ 14,760 KB
最終ジャッジ日時 2023-09-14 18:05:58
合計ジャッジ時間 4,443 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
14,660 KB
testcase_01 AC 58 ms
14,760 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 56 ms
14,664 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 57 ms
14,600 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 57 ms
14,656 KB
testcase_12 AC 57 ms
14,608 KB
testcase_13 WA -
testcase_14 AC 56 ms
14,716 KB
testcase_15 AC 56 ms
14,712 KB
testcase_16 AC 56 ms
14,716 KB
testcase_17 AC 56 ms
14,700 KB
testcase_18 AC 57 ms
14,708 KB
testcase_19 AC 58 ms
14,552 KB
testcase_20 AC 57 ms
14,708 KB
testcase_21 AC 57 ms
14,620 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using static System.Math;
using System;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = int.Parse(line[0]);
        var b = int.Parse(line[1]);
        var c = int.Parse(line[2]);
        getAns(a, b, c);
    }
    static void getAns(int a, int b, int c)
    {
        var ans = int.MaxValue;
        for (int i = 0; i <= a; i++)
            for (int j = 0; j <= b; j++)
            {
                var pay = i + 10 * j;
                if (pay >= 1)
                {
                    for (int k = 0; k <= pay - 1; k++)
                    {
                        var change = getChange(k);
                        var t = a + b - i - j + change;
                        if (t == c) ans = Min(ans, pay - k);
                    }
                }
            }
        Console.WriteLine(ans);
    }
    static int getChange(int a) => a - a / 10 * 9;
}

0