結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 165 ms
54,796 KB
testcase_01 AC 163 ms
54,856 KB
testcase_02 AC 165 ms
54,964 KB
testcase_03 AC 166 ms
55,016 KB
testcase_04 AC 165 ms
54,696 KB
testcase_05 AC 161 ms
54,728 KB
testcase_06 AC 165 ms
55,168 KB
testcase_07 WA -
testcase_08 AC 167 ms
55,088 KB
testcase_09 AC 166 ms
55,080 KB
testcase_10 AC 166 ms
55,136 KB
testcase_11 AC 165 ms
55,120 KB
testcase_12 AC 164 ms
54,688 KB
testcase_13 AC 165 ms
55,068 KB
testcase_14 AC 168 ms
54,640 KB
testcase_15 AC 133 ms
54,164 KB
testcase_16 AC 165 ms
54,836 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(" ");
		}else{
			for(int i = 0;i < list.size();i++){
				System.out.println(list.get(i));
			}
		}
	}
}
0