結果

問題 No.138 化石のバージョン
ユーザー tsunabittsunabit
提出日時 2018-05-06 14:49:43
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 2,753 bytes
コンパイル時間 3,269 ms
コンパイル使用メモリ 73,824 KB
実行使用メモリ 56,468 KB
最終ジャッジ日時 2023-09-10 10:44:59
合計ジャッジ時間 8,871 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
55,708 KB
testcase_01 AC 117 ms
55,896 KB
testcase_02 WA -
testcase_03 AC 116 ms
55,804 KB
testcase_04 AC 117 ms
55,308 KB
testcase_05 AC 117 ms
55,908 KB
testcase_06 AC 116 ms
55,472 KB
testcase_07 AC 117 ms
56,028 KB
testcase_08 WA -
testcase_09 AC 117 ms
55,992 KB
testcase_10 AC 118 ms
55,432 KB
testcase_11 AC 116 ms
55,804 KB
testcase_12 AC 118 ms
55,996 KB
testcase_13 WA -
testcase_14 AC 115 ms
55,780 KB
testcase_15 WA -
testcase_16 AC 118 ms
55,560 KB
testcase_17 AC 116 ms
55,396 KB
testcase_18 AC 116 ms
54,364 KB
testcase_19 AC 116 ms
53,828 KB
testcase_20 AC 116 ms
55,692 KB
testcase_21 AC 116 ms
55,672 KB
testcase_22 AC 118 ms
55,256 KB
testcase_23 AC 118 ms
56,468 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 117 ms
55,924 KB
testcase_27 AC 117 ms
55,852 KB
testcase_28 AC 118 ms
56,000 KB
testcase_29 AC 117 ms
55,608 KB
testcase_30 AC 119 ms
55,288 KB
testcase_31 AC 118 ms
55,660 KB
testcase_32 AC 117 ms
55,980 KB
testcase_33 AC 117 ms
56,048 KB
testcase_34 AC 119 ms
55,696 KB
testcase_35 AC 117 ms
56,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.stream.Stream;
import java.util.Arrays;

// ***問題文***
// 世の中的にはgcc 4.8.1が化石と言われているらしいです。
// ここで、化石と言われてるバージョンが特定の文字列の形式A.B.C (A,B,Cはそれぞれ0以上100以下の整数である)で
// 与えられるので、同じ形式で与えられたバージョンが化石かどうか判定してください。
// 化石のバージョンの場合は「YES」、化石のバージョンではない場合「NO」を出力してください
// 化石のバージョンとは、指定したバージョンと同じか、もしくはそれより古いものとする。
// 古いバージョンとは、「.」で区切られたものの、より左に書かれた数値が小さいかどうかとする。
// 例えば、4.8.1より 4.7.9のほうが古く、4.8.1より 4.9.0や5.0.1のほうが新しいとする。
// ***入力***
// A0.B0.C0
// A1.B1.C1
// 入力は全て整数で与えられ、.
// 区切りなことに注意
// 1行目は、化石だと言われるバージョンを示します。
// 2行目は、判定したいバージョンを示します。
// 0≤i≤1
// 0≤Ai≤100
// 0≤Bi≤100
// 0≤Ci≤100
// ***出力***
// 化石のバージョンの場合は「YES」、化石のバージョンではない場合「NO」を出力してください。
// 最後に改行をしてください。

public class No138 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);
        // 2行目をnextLineで読み込むため、数値もnextLineで読み込む
        // int n = Integer.parseInt(sc.nextLine());
        // 新しいstreamを作成し、各要素をintに変換
        // int[] x = Stream.of(sc.nextLine().split(" " , 0)).mapToInt(Integer::parseInt).toArray();
        // int[] f = Stream.of(sc.nextLine().split("\\." , 0)).mapToInt(Integer::parseInt).toArray();
        // String f = sc.next().replaceAll("\\.", "");
        int f = Integer.parseInt(sc.next().replace(".", ""));
        int s = Integer.parseInt(sc.next().replace(".", ""));
        if(s > f) {
            System.out.println("NO");
        }else {
            System.out.println("YES");
        }
        // ------------------------------------------------------------
        // System.out.println("n = " + f);
        // System.out.println("n = " + fa.length);
        // for(int i = 0; i < f.length; i++) {
        //     System.out.println("[" + i + "] = " + f[i]);
        // }
        // for(int a: x) {
        //     System.out.println("x = " + x);
        // }
    }
}
0