結果

問題 No.342 一番ワロタww
ユーザー かにかに
提出日時 2016-02-12 23:07:59
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,679 bytes
コンパイル時間 2,002 ms
コンパイル使用メモリ 80,228 KB
実行使用メモリ 58,604 KB
最終ジャッジ日時 2023-10-22 03:25:32
合計ジャッジ時間 5,211 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 147 ms
58,580 KB
testcase_02 AC 126 ms
57,760 KB
testcase_03 AC 134 ms
58,016 KB
testcase_04 AC 144 ms
58,480 KB
testcase_05 AC 145 ms
58,388 KB
testcase_06 AC 147 ms
58,416 KB
testcase_07 AC 145 ms
58,396 KB
testcase_08 AC 148 ms
58,368 KB
testcase_09 WA -
testcase_10 AC 143 ms
58,400 KB
testcase_11 AC 135 ms
58,016 KB
testcase_12 AC 145 ms
58,536 KB
testcase_13 AC 146 ms
58,424 KB
testcase_14 AC 117 ms
57,576 KB
testcase_15 AC 118 ms
57,424 KB
testcase_16 AC 154 ms
58,596 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 = "";
            }
        }
        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