結果

問題 No.342 一番ワロタww
ユーザー めうめう🎒めうめう🎒
提出日時 2016-05-11 18:45:49
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,103 bytes
コンパイル時間 2,765 ms
コンパイル使用メモリ 82,180 KB
実行使用メモリ 55,276 KB
最終ジャッジ日時 2024-04-15 15:11:25
合計ジャッジ時間 6,645 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 180 ms
42,524 KB
testcase_02 AC 178 ms
42,740 KB
testcase_03 AC 177 ms
42,260 KB
testcase_04 AC 179 ms
42,392 KB
testcase_05 AC 181 ms
42,304 KB
testcase_06 AC 184 ms
42,480 KB
testcase_07 WA -
testcase_08 AC 183 ms
42,480 KB
testcase_09 AC 182 ms
42,296 KB
testcase_10 AC 186 ms
42,496 KB
testcase_11 AC 181 ms
42,268 KB
testcase_12 AC 176 ms
42,300 KB
testcase_13 AC 181 ms
42,456 KB
testcase_14 WA -
testcase_15 AC 142 ms
41,144 KB
testcase_16 AC 177 ms
42,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Queue;
import java.util.Scanner;
import java.util.Vector;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		char s[] = str.toCharArray();
		int max_n = 0,now = 0,st = 0;
		for(int i = 0;i < str.length();i++){
			if(s[i] == 'w')st++;
			else break;
		}
		for(int i = st;i < str.length();i++){
			if(s[i] == 'w'){
				now++;
			}else{
				max_n = Math.max(max_n, now);
				now = 0;
			}
		}
		max_n = Math.max(max_n,now);
		ArrayList<String> list = new ArrayList<String>();

		String last = new String();
		int how = 0;
		for(int i = st;i < str.length();i++){
			if(s[i] == 'w'){
				how++;
			}else{
				if(how != 0){
					if(how == max_n){
						list.add(last);
					}
					how = 0;
					last = "";
				}
				last += "" + s[i];
			}
		}
		if(how == max_n){
			list.add(last);
		}
		if(list.size() == 0){
			System.out.println(" ");
		}
		for(int i = 0;i < list.size();i++){
			System.out.println(list.get(i));
		}
	}
}
0