結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 185 ms
54,984 KB
testcase_02 AC 180 ms
55,120 KB
testcase_03 AC 182 ms
55,028 KB
testcase_04 AC 182 ms
55,160 KB
testcase_05 AC 180 ms
54,924 KB
testcase_06 AC 182 ms
54,904 KB
testcase_07 WA -
testcase_08 AC 186 ms
54,940 KB
testcase_09 AC 182 ms
55,096 KB
testcase_10 AC 183 ms
54,952 KB
testcase_11 AC 183 ms
54,700 KB
testcase_12 AC 181 ms
54,784 KB
testcase_13 AC 191 ms
54,748 KB
testcase_14 WA -
testcase_15 AC 150 ms
54,320 KB
testcase_16 AC 182 ms
55,188 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);
		}
		for(int i = 0;i < list.size();i++){
			System.out.println(list.get(i));
		}
	}
}
0