結果
問題 |
No.342 一番ワロタww
|
ユーザー |
![]() |
提出日時 | 2016-02-14 01:17:43 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,200 bytes |
コンパイル時間 | 863 ms |
コンパイル使用メモリ | 112,508 KB |
実行使用メモリ | 28,000 KB |
最終ジャッジ日時 | 2024-09-22 06:19:10 |
合計ジャッジ時間 | 2,134 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 11 WA * 2 RE * 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; namespace Yukicoder { public static class Program { public static void Main (string[] args) { string line = Console.ReadLine (); string key = "w"; if (line.IndexOf (key) < 0) { Console.WriteLine (); return; } if (Enumerable.Repeat (key[0], line.Length).SequenceEqual (line)) { Console.WriteLine (); return; } for (int i = line.Length - 1; i >= 1; i--) { var matchKey = new String (Enumerable.Repeat (key, i).SelectMany (_ => _).ToArray ()); List<string> tokens = new List<string> (); int first = 0; while (first < line.Length) { int index = line.IndexOf (matchKey, first); if (index < 0) { break; } var sub = line.Substring(first, index); if (sub.Length != 0) { int lastIndex = sub.LastIndexOf(key); if (lastIndex >= 0) { tokens.Add (sub.Substring (lastIndex + 1, sub.Length - (lastIndex + 1))); } else { tokens.Add (sub); } } first = index + 1; } if (tokens.Any ()) { foreach (var element in tokens) { Console.WriteLine (element); } return; } } } } }