結果
問題 | No.342 一番ワロタww |
ユーザー | 重荷 |
提出日時 | 2016-03-29 23:44:11 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 47 ms / 5,000 ms |
コード長 | 1,236 bytes |
コンパイル時間 | 3,079 ms |
コンパイル使用メモリ | 104,560 KB |
実行使用メモリ | 22,580 KB |
最終ジャッジ日時 | 2023-08-05 16:15:55 |
合計ジャッジ時間 | 4,075 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
20,480 KB |
testcase_01 | AC | 45 ms
18,596 KB |
testcase_02 | AC | 46 ms
22,580 KB |
testcase_03 | AC | 46 ms
20,640 KB |
testcase_04 | AC | 46 ms
20,624 KB |
testcase_05 | AC | 46 ms
20,792 KB |
testcase_06 | AC | 45 ms
20,584 KB |
testcase_07 | AC | 47 ms
20,528 KB |
testcase_08 | AC | 46 ms
20,532 KB |
testcase_09 | AC | 46 ms
20,732 KB |
testcase_10 | AC | 46 ms
20,792 KB |
testcase_11 | AC | 46 ms
20,624 KB |
testcase_12 | AC | 44 ms
20,568 KB |
testcase_13 | AC | 46 ms
20,680 KB |
testcase_14 | AC | 41 ms
18,580 KB |
testcase_15 | AC | 42 ms
20,504 KB |
testcase_16 | AC | 44 ms
22,568 KB |
コンパイルメッセージ
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 && !String.IsNullOrWhiteSpace(item.word)) Console.WriteLine(item.word); } } }