結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 169 ms
55,192 KB
testcase_02 AC 169 ms
55,036 KB
testcase_03 AC 166 ms
54,968 KB
testcase_04 AC 166 ms
54,784 KB
testcase_05 AC 169 ms
54,892 KB
testcase_06 AC 166 ms
55,092 KB
testcase_07 WA -
testcase_08 AC 169 ms
55,288 KB
testcase_09 AC 169 ms
55,172 KB
testcase_10 AC 169 ms
55,016 KB
testcase_11 AC 167 ms
55,092 KB
testcase_12 AC 169 ms
55,124 KB
testcase_13 AC 171 ms
55,140 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 178 ms
55,080 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 || max_n == 0){
			System.out.println(" ");
		}
		for(int i = 0;i < list.size();i++){
			System.out.println(list.get(i));
		}
	}
}
0