結果

問題 No.825 賢いお買い物
ユーザー ひばちひばち
提出日時 2019-05-03 21:47:51
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,469 bytes
コンパイル時間 1,046 ms
コンパイル使用メモリ 68,816 KB
実行使用メモリ 23,776 KB
最終ジャッジ日時 2023-08-30 06:04:19
合計ジャッジ時間 3,557 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
21,788 KB
testcase_01 AC 63 ms
21,784 KB
testcase_02 AC 57 ms
21,608 KB
testcase_03 AC 57 ms
23,644 KB
testcase_04 AC 58 ms
21,700 KB
testcase_05 WA -
testcase_06 AC 59 ms
23,656 KB
testcase_07 AC 58 ms
21,680 KB
testcase_08 AC 64 ms
21,744 KB
testcase_09 AC 58 ms
21,532 KB
testcase_10 AC 58 ms
23,568 KB
testcase_11 AC 65 ms
21,704 KB
testcase_12 AC 64 ms
23,756 KB
testcase_13 AC 57 ms
21,540 KB
testcase_14 AC 65 ms
21,780 KB
testcase_15 AC 65 ms
21,800 KB
testcase_16 AC 64 ms
23,776 KB
testcase_17 AC 64 ms
21,868 KB
testcase_18 AC 65 ms
23,696 KB
testcase_19 AC 65 ms
21,660 KB
testcase_20 AC 66 ms
21,672 KB
testcase_21 AC 64 ms
21,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var abc = Input.ar;
        if (abc[0] + abc[1] <= abc[2]) { WriteLine("Impossible");return; }
        var val = abc[0] + 10 * abc[1];
        var e = new List<int>() { val };
        for (var i = 0; i < abc[0]; i++)
            e.Add(val - i - 1);var c = e.Count;
        for (var i = 0; i < c; i++)
            for (var j = 0; j < abc[1]; j++)
                e.Add(e[i] - 10 * (j + 1));
        e = e.OrderByDescending(v => v).ToList();
        for(var i = 0; i <e.Count; i++)
        {
            for(var j=0;j<=abc[2];j++)
            {
                if (j + 10 * (abc[2] - j) == e[i]&&val-e[i]!=0) { WriteLine(val - e[i]);return; }
            }
        }
        WriteLine("Impossible");
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] ar2D(int num)
        => Enumerable.Repeat(0, num).Select(_ => ar).ToArray();
    public static long[][] arL2D(int num)
        => Enumerable.Repeat(0, num).Select(_ => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}
0