結果
問題 | No.342 一番ワロタww |
ユーザー |
|
提出日時 | 2016-03-10 10:19:50 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 23 ms / 5,000 ms |
コード長 | 2,288 bytes |
コンパイル時間 | 1,251 ms |
コンパイル使用メモリ | 112,348 KB |
実行使用メモリ | 17,536 KB |
最終ジャッジ日時 | 2024-10-15 13:22:20 |
合計ジャッジ時間 | 2,515 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
コンパイルメッセージ
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;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;}elsecount_text = text[i].ToString() + count_text;break;}}for (int i = result_text.Count - 1; i >= 0; i--)Console.WriteLine(result_text[i]);}}}