結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 164 ms
54,664 KB
testcase_01 AC 164 ms
55,148 KB
testcase_02 AC 167 ms
55,292 KB
testcase_03 AC 167 ms
55,244 KB
testcase_04 AC 168 ms
54,956 KB
testcase_05 AC 166 ms
55,204 KB
testcase_06 AC 164 ms
54,864 KB
testcase_07 WA -
testcase_08 AC 168 ms
54,996 KB
testcase_09 AC 166 ms
55,068 KB
testcase_10 AC 163 ms
54,832 KB
testcase_11 AC 167 ms
54,964 KB
testcase_12 AC 167 ms
54,916 KB
testcase_13 AC 164 ms
54,652 KB
testcase_14 AC 164 ms
54,840 KB
testcase_15 AC 131 ms
54,180 KB
testcase_16 AC 167 ms
54,940 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 && !last.equals("")){
			list.add(last);
		}
		if(list.size() == 0 || max_n == 0){
			System.out.println(" ");
		}else{
			for(int i = 0;i < list.size();i++){
				System.out.println(list.get(i));
			}
		}
	}
}
0