結果

問題 No.342 一番ワロタww
ユーザー かにかに
提出日時 2016-02-13 00:21:32
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,721 bytes
コンパイル時間 2,341 ms
コンパイル使用メモリ 80,240 KB
実行使用メモリ 58,584 KB
最終ジャッジ日時 2023-10-22 03:46:17
合計ジャッジ時間 5,883 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 165 ms
58,484 KB
testcase_02 AC 163 ms
58,488 KB
testcase_03 AC 163 ms
58,252 KB
testcase_04 AC 161 ms
58,476 KB
testcase_05 AC 165 ms
58,288 KB
testcase_06 AC 163 ms
58,480 KB
testcase_07 AC 166 ms
58,476 KB
testcase_08 AC 163 ms
58,464 KB
testcase_09 AC 161 ms
58,260 KB
testcase_10 AC 161 ms
58,316 KB
testcase_11 AC 159 ms
58,424 KB
testcase_12 AC 155 ms
58,320 KB
testcase_13 AC 159 ms
58,468 KB
testcase_14 AC 127 ms
57,380 KB
testcase_15 AC 128 ms
57,496 KB
testcase_16 AC 161 ms
58,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int wcnt = 0;
        for(int i = 0;i < s.length();i++){
        	if(s.charAt(i) == 'w')wcnt++;
        }
        if(wcnt == 0 || wcnt == s.length()){
        	System.out.println("");
        	return;
        }
        int l = 0;
        int maxi = -1;
        String tmp = "",maxs = new String();
        Queue<String> que = new ArrayDeque<String>();
        int i = 0;
        for(;i < s.length();){
            l = 0;
            while(i < s.length() && s.charAt(i) != 'w'){
                tmp = tmp + s.charAt(i);
                i++;
            }
            while(i < s.length() && s.charAt(i) == 'w'){
                l++;
                i++;
            }
            if(l > maxi && tmp != ""){
                maxi = l;
                while(!que.isEmpty()){
                    que.remove();
                }
                que.add(tmp);
                tmp = "";
            }else if(l == maxi && tmp != ""){
                que.add(tmp);
                tmp = "";
            }else{
            	tmp = "";
            }
        }
        if(l > maxi && tmp != ""){
            maxi = l;
            while(!que.isEmpty()){
                que.remove();
            }
            que.add(tmp);
            tmp = "";
        }else if(l == maxi && tmp != ""){
            que.add(tmp);
            tmp = "";
        }
        while(!que.isEmpty()){
            System.out.println(que.element());
            que.remove();
        }
    }
}
	
0