結果
問題 | No.138 化石のバージョン |
ユーザー |
![]() |
提出日時 | 2015-06-02 16:00:46 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 138 ms / 5,000 ms |
コード長 | 1,459 bytes |
コンパイル時間 | 4,164 ms |
コンパイル使用メモリ | 79,496 KB |
実行使用メモリ | 54,272 KB |
最終ジャッジ日時 | 2024-12-29 13:21:08 |
合計ジャッジ時間 | 9,558 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
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; } }