結果

問題 No.342 一番ワロタww
ユーザー papinianuspapinianus
提出日時 2016-09-28 14:20:32
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,037 bytes
コンパイル時間 910 ms
コンパイル使用メモリ 111,592 KB
実行使用メモリ 31,656 KB
最終ジャッジ日時 2024-05-01 06:11:23
合計ジャッジ時間 3,029 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 68 ms
29,608 KB
testcase_02 AC 68 ms
31,400 KB
testcase_03 AC 65 ms
29,360 KB
testcase_04 AC 66 ms
29,752 KB
testcase_05 AC 68 ms
29,608 KB
testcase_06 AC 66 ms
31,656 KB
testcase_07 AC 68 ms
29,880 KB
testcase_08 AC 68 ms
29,612 KB
testcase_09 AC 68 ms
29,240 KB
testcase_10 AC 69 ms
29,496 KB
testcase_11 AC 67 ms
29,368 KB
testcase_12 AC 67 ms
29,500 KB
testcase_13 AC 66 ms
31,280 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 65 ms
27,444 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;
using System.Text.RegularExpressions;

namespace no342
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();
            var exp = @"(?<phrase>[^w]+?)(?<ws>[w]+)";
            var reg = new Regex(exp, (RegexOptions.Multiline | RegexOptions.CultureInvariant));
            var matches = reg.Matches(str);
            var substrs = new Dictionary<int, string>();
            foreach(Match match in matches)
            {
                var wlen = match.Groups["ws"].ToString().Length;
                var phrase = match.Groups["phrase"].ToString();
                if (substrs.ContainsKey(wlen))
                {
                    substrs[wlen] += "\r\n" + phrase;
                }
                else
                {
                    substrs.Add(wlen, phrase);
                }
            }
            Console.WriteLine(substrs.OrderByDescending(x=>x.Key).First().Value);
        }
    }
}
0