結果
| 問題 | No.87 Advent Calendar Problem | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-05-07 19:26:34 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 123 ms / 5,000 ms | 
| コード長 | 1,352 bytes | 
| コンパイル時間 | 1,939 ms | 
| コンパイル使用メモリ | 80,976 KB | 
| 実行使用メモリ | 41,832 KB | 
| 最終ジャッジ日時 | 2024-10-05 10:22:49 | 
| 合計ジャッジ時間 | 6,038 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 | 
ソースコード
package jp.fedom.challange.yuki.l2.q87;
import java.math.BigInteger;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		List<String> input = new ArrayList<>();
		while (sc.hasNext()) {
			input.add(sc.nextLine());
		}
		System.out.println(solve(input));
		sc.close();
	}
	static DayOfWeek D = LocalDate.of((int) 2014, 7, 23).getDayOfWeek();
	public static long solve_slow(List<String> in) {
		long N = Integer.valueOf(in.get(0).split(" ")[0]);
		long count = 0;
		for (long i = 2015; i <= N; i++) {
			if (LocalDate.of((int) i, 7, 23).getDayOfWeek() == D) {
				count++;
			}
		}
		return count;
	}
	public static long solve(List<String> in) {
		BigInteger N = new BigInteger(in.get(0).split(" ")[0]);
		long count400 = 0;
		for (long i = 1; i <= 400; i++) {
			if (LocalDate.of((int) i, 7, 23).getDayOfWeek() == D) {
				count400++;
			}
		}
		long count = 0;
		long M = N.mod(BigInteger.valueOf(400L)).longValue();
		for (long i = 0; i <= M; i++) {
			if (LocalDate.of((int) i, 7, 23).getDayOfWeek() == D) {
				count++;
			}
		}
		return (count400 * N.divide(BigInteger.valueOf(400L)).longValue()) + count - 288L;
	}
}
            
            
            
        