結果

問題 No.342 一番ワロタww
ユーザー 重荷重荷
提出日時 2016-03-29 23:42:30
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,195 bytes
コンパイル時間 2,237 ms
コンパイル使用メモリ 111,684 KB
実行使用メモリ 25,976 KB
最終ジャッジ日時 2024-04-10 05:55:29
合計ジャッジ時間 2,301 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
21,304 KB
testcase_01 AC 26 ms
25,328 KB
testcase_02 AC 25 ms
23,724 KB
testcase_03 AC 25 ms
23,608 KB
testcase_04 WA -
testcase_05 AC 25 ms
23,776 KB
testcase_06 AC 26 ms
25,776 KB
testcase_07 AC 25 ms
23,984 KB
testcase_08 AC 25 ms
23,784 KB
testcase_09 AC 25 ms
21,684 KB
testcase_10 AC 25 ms
23,964 KB
testcase_11 AC 25 ms
23,740 KB
testcase_12 AC 25 ms
25,852 KB
testcase_13 AC 24 ms
23,732 KB
testcase_14 AC 24 ms
23,856 KB
testcase_15 AC 24 ms
23,548 KB
testcase_16 AC 25 ms
25,976 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) Console.WriteLine(item.word);
        }
    }
}
0