結果

問題 No.342 一番ワロタww
ユーザー HimatsubushinHimatsubushin
提出日時 2016-03-10 10:19:50
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 2,288 bytes
コンパイル時間 985 ms
コンパイル使用メモリ 113,212 KB
実行使用メモリ 17,792 KB
最終ジャッジ日時 2024-04-23 13:23:29
合計ジャッジ時間 2,075 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
17,536 KB
testcase_01 AC 23 ms
17,664 KB
testcase_02 AC 22 ms
17,536 KB
testcase_03 AC 23 ms
17,536 KB
testcase_04 AC 23 ms
17,536 KB
testcase_05 AC 24 ms
17,536 KB
testcase_06 AC 23 ms
17,792 KB
testcase_07 AC 23 ms
17,408 KB
testcase_08 AC 22 ms
17,280 KB
testcase_09 AC 23 ms
17,664 KB
testcase_10 AC 24 ms
17,408 KB
testcase_11 AC 25 ms
17,408 KB
testcase_12 AC 24 ms
17,536 KB
testcase_13 AC 25 ms
17,536 KB
testcase_14 AC 23 ms
17,536 KB
testcase_15 AC 23 ms
17,536 KB
testcase_16 AC 23 ms
17,280 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;

namespace No342
{
    class Program
    {
        enum LoopMode
        {
            search,
            count_w,
            count_text
        }

        static void Main(string[] args)
        {
            LoopMode mode = LoopMode.search; 
            int count_w = 0;
            string count_text = "";
            int max_text = 0;
            List<string> result_text = new List<string>();

            string text = "w" + Console.ReadLine();

            for (int i = text.Length - 1; i >= 0; i--)
            {
                switch(mode)
                {
                    case LoopMode.search:
                        if (text[i] == 'w')
                        {
                            mode = LoopMode.count_w;
                            count_w = 1;
                        }
                        break;

                    case LoopMode.count_w:
                        if (text[i] == 'w')
                            count_w++;
                        else
                        {
                            mode = LoopMode.count_text;
                            count_text = text[i].ToString();
                        }
                        break;

                    case LoopMode.count_text:
                        if (text[i] == 'w')
                        {
                            if (max_text < count_w)
                            {
                                result_text.Clear();
                                result_text.Add(count_text);
                                max_text = count_w;
                            }
                            else if (max_text == count_w)
                            {
                                result_text.Add(count_text);
                                max_text = count_w;
                            }
                            mode = LoopMode.count_w;
                            count_w = 1;
                        }
                        else
                            count_text = text[i].ToString() + count_text;
                        break;
                }
            }

            for (int i = result_text.Count - 1; i >= 0; i--)
                Console.WriteLine(result_text[i]);
        }
    }
}
0