結果

問題 No.87 Advent Calendar Problem
ユーザー DemocoDemoco
提出日時 2015-05-04 19:52:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 654 bytes
コンパイル時間 2,081 ms
コンパイル使用メモリ 73,776 KB
実行使用メモリ 57,524 KB
最終ジャッジ日時 2023-09-19 06:51:17
合計ジャッジ時間 7,195 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,616 KB
testcase_01 AC 127 ms
55,500 KB
testcase_02 AC 127 ms
55,728 KB
testcase_03 AC 126 ms
55,544 KB
testcase_04 AC 127 ms
56,160 KB
testcase_05 AC 125 ms
55,992 KB
testcase_06 AC 127 ms
55,860 KB
testcase_07 AC 126 ms
55,688 KB
testcase_08 AC 127 ms
55,540 KB
testcase_09 AC 127 ms
55,604 KB
testcase_10 AC 126 ms
55,796 KB
testcase_11 AC 129 ms
57,524 KB
testcase_12 AC 126 ms
55,832 KB
testcase_13 AC 127 ms
55,808 KB
testcase_14 AC 126 ms
55,744 KB
testcase_15 AC 126 ms
55,816 KB
testcase_16 AC 126 ms
55,636 KB
testcase_17 AC 126 ms
55,348 KB
testcase_18 AC 126 ms
55,768 KB
testcase_19 AC 126 ms
55,948 KB
testcase_20 AC 127 ms
55,540 KB
testcase_21 AC 128 ms
54,188 KB
testcase_22 AC 126 ms
56,132 KB
testcase_23 AC 126 ms
55,572 KB
testcase_24 AC 124 ms
55,672 KB
testcase_25 AC 125 ms
55,900 KB
testcase_26 AC 125 ms
55,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class Yukico87 {
	public static void main(String[] args) {
		Scanner stdio = new Scanner(System.in);
		
		long n = stdio.nextLong();
		long y = 2015;
		long a = (n-y);
		long ans =0;
		long[] memo = new long[400];
		
		int wed = zeller(23,7,14,20);
		int j =20;
		int k =15;
	
		for(int i=0; i<400; i++) {
			if(wed == zeller(23, 7, k, j)) {
				ans++;
			}
			k++;
			if(k==100) {
				k=0;
				j++;
			}
			memo[i] = ans;
		}
		ans = ans*(a/400);
		a = a%400;
		ans = ans + memo[(int)a];
		System.out.println(ans);
	}
	public static int zeller(int q, int m, int k, int j) {
		return ((q+(((m+1)*26)/10)+k+(k/4)+(j/4) - 2*j)%7);
	}
}
0