結果
問題 | No.548 国士無双 |
ユーザー |
![]() |
提出日時 | 2018-02-19 16:54:30 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 978 bytes |
コンパイル時間 | 1,738 ms |
コンパイル使用メモリ | 103,808 KB |
実行使用メモリ | 17,152 KB |
最終ジャッジ日時 | 2024-07-05 20:32:28 |
合計ジャッジ時間 | 3,545 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 WA * 1 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; namespace _548 { class Program { static void Main(string[] args) { string s = Console.ReadLine(); int[] a = new int[26]; bool flag = true; for (int i = 0; i < s.Length; i++) { if (s[i] > 'm') flag = false; a[s[i] - 'a']++; } if (flag) { int two = 0; char ret = ' '; for (int j = 0; j <= 'm' - 'a'; j++) { if (a[j] >= 2) two++; else if (a[j] == 0) ret = (char)(j + 'a'); } if (two > 1) Console.WriteLine("Impossible"); else if (two == 1) Console.WriteLine(ret); else { for (char i = 'a'; i <= 'm'; i++) Console.WriteLine(i); } } else Console.WriteLine("Impossible"); } } }