結果

問題 No.188 HAPPY DAY
ユーザー ikawaiikawai
提出日時 2023-09-04 10:44:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 245 ms / 1,000 ms
コード長 906 bytes
コンパイル時間 2,351 ms
コンパイル使用メモリ 72,432 KB
実行使用メモリ 58,968 KB
最終ジャッジ日時 2023-09-04 10:44:12
合計ジャッジ時間 2,910 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import java.util.Calendar;
import java.text.SimpleDateFormat;

class Wandbox
{
    public static void main(String[] args)
    {
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
        
        calendar.set(2014, 11, 31, 1, 1, 1);
        int cnt = 0;
        
        while(calendar.get(calendar.YEAR) <= 2015) {
        	
			calendar.add(Calendar.DATE, 1);
			
        	if(calendar.get(calendar.YEAR) != 2015) {
        		break;
        	} 
        		
        	String time =sdf.format(calendar.getTime());
        	int mon = Integer.parseInt(time.substring(5,7));
        	int day10 = Integer.parseInt(time.substring(8,9));
        	int day1 = Integer.parseInt(time.substring(9));
        	if(mon == day1 + day10) {
        		cnt++;
        	}
			
        }
        
        
        
        System.out.println(cnt);
        
    }
}
0