結果
問題 |
No.342 一番ワロタww
|
ユーザー |
![]() |
提出日時 | 2016-03-29 23:42:30 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,195 bytes |
コンパイル時間 | 1,079 ms |
コンパイル使用メモリ | 105,344 KB |
実行使用メモリ | 17,792 KB |
最終ジャッジ日時 | 2024-10-02 07:32:13 |
合計ジャッジ時間 | 2,184 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
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; public struct KusaItem{ public string word; public int kusaCnt; public KusaItem(string word,int kusaCnt){ this.word=word; this.kusaCnt=kusaCnt; } } class Kusa{ static void Main(){ char[] chars = Console.ReadLine().ToCharArray(); List<KusaItem> list = new List<KusaItem>(); int cnt=0; string str=""; for(int i=0;i<chars.Length;i++){ if(chars[i] != 'w') { //Console.WriteLine(chars[i]); str+=chars[i]; cnt=0; } else { cnt++; if((chars.Length-1 > i && chars[i+1] != 'w') || chars.Length-1 <= i){ list.Add(new KusaItem(str,cnt)); str=""; } } } int max=0; //linqでやりたかった(´・ω・`) foreach(var item in list) if((max < item.kusaCnt) && !String.IsNullOrWhiteSpace(item.word)) max = item.kusaCnt; foreach(KusaItem item in list){ if(item.kusaCnt == max) Console.WriteLine(item.word); } } }