結果

問題 No.342 一番ワロタww
ユーザー 14番14番
提出日時 2016-05-25 23:30:11
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 2,120 bytes
コンパイル時間 804 ms
コンパイル使用メモリ 115,756 KB
実行使用メモリ 26,852 KB
最終ジャッジ日時 2024-04-23 13:25:14
合計ジャッジ時間 1,834 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
24,492 KB
testcase_01 AC 25 ms
24,536 KB
testcase_02 AC 25 ms
24,880 KB
testcase_03 AC 25 ms
26,600 KB
testcase_04 AC 25 ms
24,796 KB
testcase_05 AC 25 ms
26,852 KB
testcase_06 AC 25 ms
24,668 KB
testcase_07 AC 25 ms
22,964 KB
testcase_08 AC 24 ms
22,968 KB
testcase_09 AC 25 ms
24,620 KB
testcase_10 AC 26 ms
24,924 KB
testcase_11 AC 27 ms
24,788 KB
testcase_12 AC 26 ms
24,540 KB
testcase_13 AC 26 ms
26,836 KB
testcase_14 AC 22 ms
24,284 KB
testcase_15 AC 23 ms
26,356 KB
testcase_16 AC 24 ms
24,952 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.Text;
using System.Linq;

class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        string inpt = Reader.ReadLine();
        
        string txt = string.Empty;
        string w = string.Empty;
        
        List<Word> list = new List<Word>();
        for(int i=0; i<inpt.Length; i++) {
            if(inpt[i] == 'w') {
                w+=inpt[i];
            } else
            {
                if(w.Length > 0) {
                    list.Add(new Word(txt, w));
                    w = string.Empty;
                    txt = string.Empty;
                }
                txt += inpt[i];
            }
        }
        if(w.Length > 0) {
            list.Add(new Word(txt, w));
        }
        if(list.Count(a=>a.Text.Length > 0) == 0) {
            Console.WriteLine(string.Empty);
            return;
        }
        int max = list.Where(a=>a.Text.Length > 0).Max(a=>a.Waros.Length);
        if(max == 0) {
            Console.WriteLine(string.Empty);
            return;
        }
        list.Where(a=>a.Text.Length > 0 && a.Waros.Length == max).ToList().ForEach(a=>Console.WriteLine(a.Text));
        

    }
    
    public class Word {
        public String Text;
        public String Waros;
        
        public Word(string txt, string w) {
            this.Text = txt;
            this.Waros = w;
        }
    }
    

    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"



wwそれなww




";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0