結果

問題 No.138 化石のバージョン
ユーザー AoiroFukurouAoiroFukurou
提出日時 2015-06-02 16:00:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 1,459 bytes
コンパイル時間 3,524 ms
コンパイル使用メモリ 80,116 KB
実行使用メモリ 56,392 KB
最終ジャッジ日時 2023-08-28 13:26:23
合計ジャッジ時間 9,487 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,788 KB
testcase_01 AC 123 ms
55,800 KB
testcase_02 AC 123 ms
55,832 KB
testcase_03 AC 124 ms
55,920 KB
testcase_04 AC 124 ms
55,840 KB
testcase_05 AC 123 ms
55,908 KB
testcase_06 AC 123 ms
55,944 KB
testcase_07 AC 125 ms
55,696 KB
testcase_08 AC 125 ms
55,872 KB
testcase_09 AC 124 ms
56,016 KB
testcase_10 AC 124 ms
56,016 KB
testcase_11 AC 124 ms
56,044 KB
testcase_12 AC 124 ms
55,764 KB
testcase_13 AC 124 ms
56,000 KB
testcase_14 AC 123 ms
56,196 KB
testcase_15 AC 124 ms
55,736 KB
testcase_16 AC 123 ms
56,184 KB
testcase_17 AC 123 ms
53,956 KB
testcase_18 AC 123 ms
55,768 KB
testcase_19 AC 124 ms
56,100 KB
testcase_20 AC 123 ms
56,164 KB
testcase_21 AC 122 ms
56,116 KB
testcase_22 AC 121 ms
55,880 KB
testcase_23 AC 122 ms
54,208 KB
testcase_24 AC 124 ms
56,088 KB
testcase_25 AC 118 ms
55,860 KB
testcase_26 AC 123 ms
56,116 KB
testcase_27 AC 122 ms
56,044 KB
testcase_28 AC 122 ms
56,392 KB
testcase_29 AC 121 ms
56,012 KB
testcase_30 AC 121 ms
55,988 KB
testcase_31 AC 123 ms
56,032 KB
testcase_32 AC 122 ms
55,928 KB
testcase_33 AC 120 ms
55,580 KB
testcase_34 AC 118 ms
55,712 KB
testcase_35 AC 121 ms
55,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package b2015_5_31;

import java.util.Scanner;

public class KasekiVer3 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s1 = sc.nextLine();
		String s2 = sc.nextLine();
		sc.close();
		String a = "";
		String b = "";
		int ca1 = 1;
		int ca2 = ca1 + Nuki(s1, a, ca1).length() + 1;
		int cb1 = 1;
		int cb2 = cb1 + Nuki(s2, b, cb1).length() + 1;
		int Voa = Integer.parseInt(Nuki(s1, a, ca1));
		int Vob = Integer.parseInt(Nuki(s2, b, cb1));
		int n = 0;
		for(int i = 0; i<4; i++){
			if(n==2&&Voa==Vob){
				System.out.println("YES");
				break;
			}if(Voa >Vob){
				System.out.println("YES");
				break;
			}else if(Voa < Vob){
				System.out.println("NO");
				break;
			}else if(Voa==Vob){
			a = "";
			b = "";
			Voa = 0;
			Vob = 0;
			if(n==0){
				Voa =  Integer.parseInt(Nuki(s1, a, ca2));
				 Vob = Integer.parseInt(Nuki(s2, b, cb2));
			}else if(n==1){
				int ca3 = ca1 + Nuki(s1, a, ca1).length() + Nuki(s1, a, ca2).length() + 2;
				int cb3 = cb1 + Nuki(s2, b, cb1).length() + Nuki(s2, b, cb2).length() + 2;
				Voa =  Integer.parseInt(Nuki(s1, a, ca3));
				 Vob = Integer.parseInt(Nuki(s2, b, cb3));
					}
			}
			n++;
			}
		}
	public static String Nuki(String s, String ab, int c){
		if(c>s.length()){
			c = s.length();
		}
		while(!(s.substring(c-1, c)).equals(".")){
			ab+=s.substring(c-1, c);
			if(c==s.length()){
				break;
			}else if(c<s.length()){
				c++;
			}
	}
		return ab;
	}
	}
0