結果

問題 No.342 一番ワロタww
ユーザー 37zigen37zigen
提出日時 2016-03-22 15:20:42
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,211 bytes
コンパイル時間 2,585 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 58,880 KB
最終ジャッジ日時 2024-04-08 21:53:39
合計ジャッジ時間 5,932 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 160 ms
58,860 KB
testcase_02 AC 167 ms
58,856 KB
testcase_03 AC 161 ms
58,840 KB
testcase_04 AC 161 ms
58,880 KB
testcase_05 AC 163 ms
58,856 KB
testcase_06 AC 161 ms
58,840 KB
testcase_07 RE -
testcase_08 AC 165 ms
58,864 KB
testcase_09 AC 162 ms
58,840 KB
testcase_10 AC 160 ms
58,840 KB
testcase_11 AC 159 ms
58,860 KB
testcase_12 AC 160 ms
58,836 KB
testcase_13 AC 164 ms
58,872 KB
testcase_14 RE -
testcase_15 AC 132 ms
58,000 KB
testcase_16 AC 168 ms
58,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder342;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {
	static class Tuple implements Comparable<Tuple>{
		String str;
		int count;
		Tuple(String str,int count){
			this.str=str;
			this.count=count;
		}
		public int compareTo(Tuple o){
			int a=Integer.compare(o.count, count);
			if(a==0)return 1;
			return a;
		}
	}
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		String str=sc.next();
		PriorityQueue<Tuple> queue=new PriorityQueue(100);
		String str2="";
		int count=0;
		for(int i=0;i<str.length();i++){
			if(str.charAt(i)=='w'&&i==str.length()-1){
				count++;
				queue.add(new Tuple(str2,count));
			}else if(str.charAt(i)!='w'){
				if(i>=1){
					if(str.charAt(i-1)=='w'){
						if(!str2.equals("")){
							queue.add(new Tuple(str2,count));
						}
						str2="";
						count=0;
					}
				}
				str2+=str.charAt(i);
			}else if(str.charAt(i)=='w'){
				count++;
			}
		}
		if(queue.isEmpty()){
			System.out.println();
		}
		int a=queue.peek().count;
		while(!queue.isEmpty()){
			Tuple t=queue.poll();
			if(a!=t.count)break;
			System.out.println(t.str);
		}
//		System.err.println("End");
		sc.close();
	}
}
0