結果
問題 | No.342 一番ワロタww |
ユーザー |
![]() |
提出日時 | 2016-04-22 12:11:29 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 30 ms / 5,000 ms |
コード長 | 1,264 bytes |
コンパイル時間 | 812 ms |
コンパイル使用メモリ | 107,136 KB |
実行使用メモリ | 18,688 KB |
最終ジャッジ日時 | 2024-10-15 13:23:00 |
合計ジャッジ時間 | 1,866 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
コンパイルメッセージ
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; 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(); }); } } }