結果

問題 No.342 一番ワロタww
ユーザー AreTrashAreTrash
提出日時 2016-04-22 12:11:29
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 61 ms / 5,000 ms
コード長 1,264 bytes
コンパイル時間 2,207 ms
コンパイル使用メモリ 107,500 KB
実行使用メモリ 23,416 KB
最終ジャッジ日時 2023-08-05 16:16:07
合計ジャッジ時間 4,100 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
23,400 KB
testcase_01 AC 57 ms
21,528 KB
testcase_02 AC 57 ms
21,392 KB
testcase_03 AC 58 ms
23,416 KB
testcase_04 AC 56 ms
21,460 KB
testcase_05 AC 57 ms
21,472 KB
testcase_06 AC 55 ms
23,416 KB
testcase_07 AC 58 ms
21,552 KB
testcase_08 AC 57 ms
21,404 KB
testcase_09 AC 58 ms
21,328 KB
testcase_10 AC 61 ms
19,500 KB
testcase_11 AC 60 ms
21,464 KB
testcase_12 AC 57 ms
21,368 KB
testcase_13 AC 59 ms
21,452 KB
testcase_14 AC 54 ms
23,408 KB
testcase_15 AC 51 ms
21,456 KB
testcase_16 AC 56 ms
21,572 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;

namespace No342_1{
    public class Program{
        public static void Main(string[] args){
            const char constChar = 'w';
            var charList = Console.ReadLine().SkipWhile(c => c == constChar).ToList();
            var strList = new List<string>();
            if(charList.Count == 0 || !charList.Exists(c => c == constChar)){
                Console.WriteLine();
                return;
            }

            var sb = new StringBuilder();
            sb.Append(charList[0]);
            for(var i = 1; i < charList.Count; i++){
                if(charList[i - 1] == constChar && charList[i] != constChar){
                    strList.Add(sb.ToString());
                    sb.Clear();
                }
                sb.Append(charList[i]);
            }
            strList.Add(sb.ToString());

            Func<string, int> charCount = s => s.Count(c => c == constChar);
            strList.Where(s => charCount(s) == strList.Max(charCount)).ToList()
                .ForEach(s => {
                    s.TakeWhile(c => c != constChar).ToList().ForEach(Console.Write);
                    Console.WriteLine();
                });
        }
    }
}
0