結果

問題 No.188 HAPPY DAY
ユーザー bigbear90560bigbear90560
提出日時 2015-07-03 00:31:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 167 ms / 1,000 ms
コード長 720 bytes
コンパイル時間 4,103 ms
コンパイル使用メモリ 72,000 KB
実行使用メモリ 55,608 KB
最終ジャッジ日時 2023-08-29 02:25:39
合計ジャッジ時間 4,392 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 167 ms
55,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Calendar;

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

	public static void main(String[] args) {
	    int year = 2015;
		int lastDate = 0;
		int resNum = 0;
		
	    Calendar cal = Calendar.getInstance();

	    for (int month=1; month<=12; month++) {
		    cal.clear();
		    cal.set(year, month - 1, 1);
		    // 月末の日付を求める
		    cal.add(Calendar.MONTH, 1);
		    cal.add(Calendar.DATE, -1);
		    lastDate = cal.get(Calendar.DATE);

		    for (int date = 1; date <= lastDate; date++) {
		    	int tensPlace = (int) Math.floor(date / 10);
		    	int onePlace = date % 10;
		    	if (month == tensPlace+onePlace) resNum++; 
		    }
	    }
	    System.out.println(resNum);
	}

}
0