結果

問題 No.342 一番ワロタww
ユーザー 37zigen37zigen
提出日時 2016-03-22 15:03:40
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,096 bytes
コンパイル時間 2,488 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 58,996 KB
最終ジャッジ日時 2024-04-08 21:52:07
合計ジャッジ時間 6,316 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 170 ms
58,868 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 172 ms
58,856 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 170 ms
58,836 KB
testcase_10 AC 169 ms
58,848 KB
testcase_11 RE -
testcase_12 AC 174 ms
58,836 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
権限があれば一括ダウンロードができます

ソースコード

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++;
			}
		}
		int a;
		Tuple t=queue.poll();
		a=t.count;
		while(a==t.count){
			System.out.println(t.str);
			t=queue.poll();
		}
	}
}
0