結果

問題 No.779 Heisei
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2019-02-19 21:48:06
言語 Java19
(openjdk 21)
結果
AC  
実行時間 249 ms / 1,000 ms
コード長 1,049 bytes
コンパイル時間 2,191 ms
コンパイル使用メモリ 80,712 KB
実行使用メモリ 61,568 KB
最終ジャッジ日時 2023-08-06 02:25:06
合計ジャッジ時間 9,304 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 227 ms
59,544 KB
testcase_01 AC 229 ms
59,692 KB
testcase_02 AC 234 ms
61,568 KB
testcase_03 AC 231 ms
59,944 KB
testcase_04 AC 236 ms
59,880 KB
testcase_05 AC 231 ms
59,708 KB
testcase_06 AC 236 ms
59,972 KB
testcase_07 AC 236 ms
59,780 KB
testcase_08 AC 244 ms
59,712 KB
testcase_09 AC 232 ms
59,440 KB
testcase_10 AC 235 ms
58,164 KB
testcase_11 AC 249 ms
59,800 KB
testcase_12 AC 234 ms
59,692 KB
testcase_13 AC 234 ms
59,936 KB
testcase_14 AC 233 ms
59,512 KB
testcase_15 AC 239 ms
59,640 KB
testcase_16 AC 233 ms
59,272 KB
testcase_17 AC 231 ms
59,704 KB
testcase_18 AC 234 ms
59,684 KB
testcase_19 AC 234 ms
57,976 KB
testcase_20 AC 230 ms
59,668 KB
testcase_21 AC 240 ms
59,808 KB
testcase_22 AC 236 ms
60,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.text.*;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int y = sc.nextInt();
        int m = sc.nextInt();
        int d = sc.nextInt();
        solve(y, m, d);
    }
    
    static void solve(int y, int m, int d) throws Exception {
        DateFormat df = new SimpleDateFormat("yyyyMMdd");
        String str = String.format("%04d", y) + String.format("%02d", m) + String.format("%02d", d);
        Calendar target = prepareCalendar(str, df);
        Calendar begin = prepareCalendar("19890108", df);
        Calendar end = prepareCalendar("20190430", df);
        if( !begin.after(target) && !end.before(target) ) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
    
    static Calendar prepareCalendar(String s, DateFormat df) throws Exception {
        Calendar cal = Calendar.getInstance();
        cal.setTime(df.parse(s));
        return cal;
    }
    
}
0