結果
問題 |
No.825 賢いお買い物
|
ユーザー |
![]() |
提出日時 | 2019-05-03 21:38:56 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,147 bytes |
コンパイル時間 | 5,516 ms |
コンパイル使用メモリ | 116,036 KB |
実行使用メモリ | 26,020 KB |
最終ジャッジ日時 | 2024-12-31 17:38:15 |
合計ジャッジ時間 | 4,888 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 1 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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]; for(var i = val - 1; i >= 0; i--) { for(var j=0;j<=abc[2];j++) { if (j + 10 * (abc[2] - j) == i) { WriteLine(val - 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; }