結果

問題 No.342 一番ワロタww
ユーザー 重荷重荷
提出日時 2016-03-29 23:44:11
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 1,236 bytes
コンパイル時間 903 ms
コンパイル使用メモリ 115,832 KB
実行使用メモリ 25,832 KB
最終ジャッジ日時 2024-04-23 13:23:58
合計ジャッジ時間 2,017 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
23,468 KB
testcase_01 AC 25 ms
25,456 KB
testcase_02 AC 25 ms
23,988 KB
testcase_03 AC 25 ms
23,792 KB
testcase_04 AC 25 ms
25,716 KB
testcase_05 AC 25 ms
25,828 KB
testcase_06 AC 25 ms
25,832 KB
testcase_07 AC 25 ms
23,864 KB
testcase_08 AC 24 ms
23,608 KB
testcase_09 AC 25 ms
25,696 KB
testcase_10 AC 25 ms
25,820 KB
testcase_11 AC 25 ms
25,572 KB
testcase_12 AC 24 ms
25,584 KB
testcase_13 AC 24 ms
23,736 KB
testcase_14 AC 23 ms
23,528 KB
testcase_15 AC 24 ms
25,316 KB
testcase_16 AC 24 ms
23,676 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;
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);
        }
    }
}
0