結果
問題 | No.185 和風 |
ユーザー | 明智重蔵 |
提出日時 | 2015-09-19 16:57:25 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 68 ms / 1,000 ms |
コード長 | 1,493 bytes |
コンパイル時間 | 4,711 ms |
コンパイル使用メモリ | 107,268 KB |
実行使用メモリ | 23,008 KB |
最終ジャッジ日時 | 2023-09-26 13:42:51 |
合計ジャッジ時間 | 5,833 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 66 ms
22,936 KB |
testcase_01 | AC | 68 ms
22,760 KB |
testcase_02 | AC | 67 ms
22,904 KB |
testcase_03 | AC | 67 ms
22,880 KB |
testcase_04 | AC | 68 ms
23,008 KB |
testcase_05 | AC | 67 ms
22,892 KB |
testcase_06 | AC | 67 ms
22,988 KB |
コンパイルメッセージ
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; class Program { static string InputPattern = "Input4"; static List<string> GetInputList() { var WillReturn = new List<string>(); if (InputPattern == "Input1") { WillReturn.Add("2"); WillReturn.Add("3 5"); WillReturn.Add("7 9"); //2 } else if (InputPattern == "Input2") { WillReturn.Add("2"); WillReturn.Add("3 5"); WillReturn.Add("7 10"); //-1 } else if (InputPattern == "Input3") { WillReturn.Add("1"); WillReturn.Add("8 2"); //-1 } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static void Main() { List<string> InputList = GetInputList(); var SikakuSet = new HashSet<int>(); foreach (string EachStr in InputList.Skip(1)) { int[] wkArr = EachStr.Split(' ').Select(X => int.Parse(X)).ToArray(); SikakuSet.Add(wkArr[1] - wkArr[0]); } if (SikakuSet.Count >= 2) { //ユニーク解でなければNG Console.WriteLine(-1); return; } if (SikakuSet.First() <= 0) { //正整数の解でなければNG Console.WriteLine(-1); return; } Console.WriteLine(SikakuSet.First()); } }