結果

問題 No.188 HAPPY DAY
ユーザー bigbear90560
提出日時 2015-07-03 22:07:20
言語 Java
(openjdk 23)
結果
AC  
実行時間 269 ms / 1,000 ms
コード長 883 bytes
コンパイル時間 4,490 ms
コンパイル使用メモリ 77,604 KB
実行使用メモリ 43,332 KB
最終ジャッジ日時 2024-12-30 20:25:33
合計ジャッジ時間 5,569 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.text.DateFormat;

/**
 * No.188 HAPPY DAY
 */
public class HappyDay {

    public static void main(String[] args) {

        final int year = 2015;
        int tensPlace = 0;
        int onePlace = 0;
        int resNum = 0;
        String str = "";

        DateFormat format = DateFormat.getDateInstance();
        format.setLenient(false);

        for (int day=1; day<=31; day++) {
            tensPlace = (int) Math.floor(day / 10);
            onePlace = day % 10;
            str = year + "/" + (tensPlace + onePlace) + "/" + tensPlace + "" + onePlace;
            if (day > 29) {
            	try {
	                format.parse(str);
	                resNum++;
	            } catch (Exception ex) {
	                // 何もしない
	            }
            } else {
            	resNum++;
            }
        }
        System.out.println(resNum);
    }
}
0