結果

問題 No.342 一番ワロタww
ユーザー nanophoto12nanophoto12
提出日時 2016-02-14 01:23:52
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 98 ms / 5,000 ms
コード長 1,222 bytes
コンパイル時間 4,079 ms
コンパイル使用メモリ 105,016 KB
実行使用メモリ 24,676 KB
最終ジャッジ日時 2023-08-05 16:13:32
合計ジャッジ時間 5,836 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
24,636 KB
testcase_01 AC 86 ms
22,700 KB
testcase_02 AC 86 ms
22,564 KB
testcase_03 AC 85 ms
24,676 KB
testcase_04 AC 86 ms
24,560 KB
testcase_05 AC 86 ms
24,592 KB
testcase_06 AC 83 ms
20,564 KB
testcase_07 AC 98 ms
22,540 KB
testcase_08 AC 89 ms
22,552 KB
testcase_09 AC 87 ms
22,608 KB
testcase_10 AC 86 ms
20,536 KB
testcase_11 AC 87 ms
22,592 KB
testcase_12 AC 88 ms
22,616 KB
testcase_13 AC 88 ms
22,500 KB
testcase_14 AC 75 ms
23,956 KB
testcase_15 AC 79 ms
22,524 KB
testcase_16 AC 86 ms
22,636 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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 - first);
					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 + matchKey.Length;
				}
				if (tokens.Any ()) {
					foreach (var element in tokens) {
						Console.WriteLine (element);
					}
					return;
				}
			}
		}
	}
}
0