結果
問題 | No.188 HAPPY DAY |
ユーザー |
![]() |
提出日時 | 2018-04-19 15:50:06 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 54 ms / 1,000 ms |
コード長 | 1,331 bytes |
コンパイル時間 | 2,028 ms |
コンパイル使用メモリ | 77,044 KB |
実行使用メモリ | 49,624 KB |
最終ジャッジ日時 | 2024-06-27 04:48:23 |
合計ジャッジ時間 | 2,475 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 |
ソースコード
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);}}