結果

問題 No.188 HAPPY DAY
ユーザー YamaKasaYamaKasa
提出日時 2018-04-19 15:50:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 44 ms / 1,000 ms
コード長 1,331 bytes
コンパイル時間 2,326 ms
コンパイル使用メモリ 74,176 KB
実行使用メモリ 48,652 KB
最終ジャッジ日時 2023-09-09 11:42:29
合計ジャッジ時間 2,585 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import java.util.HashMap;
import java.util.Map;
public class Main{
	public static void main(String[] args) {
		//カレンダーの作成
		Map<Integer, Integer[]> calendar = new HashMap<Integer, Integer[]>();
		Integer[] n_31 = new Integer[31];
		Integer[] n_30 = new Integer[30];
		Integer[] n_28 = new Integer[28];
		for(int i = 0; i < 31; i++) {
			n_31[i] = i+1;
		}
		for(int i = 0; i < 30; i++) {
			n_30[i] = i+1;
		}
		for(int i = 0; i < 28; i++) {
			n_28[i] = i+1;
		}
		calendar.put(1, n_31);
		calendar.put(2, n_28);
		calendar.put(3, n_31);
		calendar.put(4, n_30);
		calendar.put(5, n_31);
		calendar.put(6, n_30);
		calendar.put(7, n_31);
		calendar.put(8, n_31);
		calendar.put(9, n_30);
		calendar.put(10, n_31);
		calendar.put(11, n_30);
		calendar.put(12, n_31);

//		for(int i = 0; i < 12; i++) {
//			for(int j=0; j <calendar.get(i+1).length ; j++) {
//				System.out.print(calendar.get(i+1)[j]+" ");
//			}
//			System.out.println();
//		}
		//HAPPY DAYの成立
		int k =0; //HAPPY DAYの日数
		for(int i = 0; i < 12; i++) {
			for(int j = 0; j < calendar.get(i+1).length; j++) {
				if((i+1) == (calendar.get(i+1)[j] - (calendar.get(i+1)[j]/10)*10) + calendar.get(i+1)[j]/10) {
					k ++;
					//System.out.println(i+1 + "月" + calendar.get(i+1)[j] +"日");
				}
			}
		}
		System.out.println(k);
	}

}
0