結果
問題 | No.87 Advent Calendar Problem |
ユーザー | mitsuo |
提出日時 | 2016-05-07 19:26:34 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 142 ms / 5,000 ms |
コード長 | 1,352 bytes |
コンパイル時間 | 2,323 ms |
コンパイル使用メモリ | 84,476 KB |
実行使用メモリ | 54,828 KB |
最終ジャッジ日時 | 2024-04-15 13:38:39 |
合計ジャッジ時間 | 7,136 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 139 ms
54,032 KB |
testcase_01 | AC | 135 ms
54,076 KB |
testcase_02 | AC | 138 ms
54,228 KB |
testcase_03 | AC | 136 ms
54,068 KB |
testcase_04 | AC | 136 ms
54,276 KB |
testcase_05 | AC | 135 ms
54,564 KB |
testcase_06 | AC | 138 ms
54,264 KB |
testcase_07 | AC | 137 ms
54,828 KB |
testcase_08 | AC | 136 ms
54,260 KB |
testcase_09 | AC | 137 ms
54,292 KB |
testcase_10 | AC | 138 ms
53,920 KB |
testcase_11 | AC | 136 ms
54,352 KB |
testcase_12 | AC | 136 ms
54,368 KB |
testcase_13 | AC | 137 ms
54,328 KB |
testcase_14 | AC | 122 ms
53,088 KB |
testcase_15 | AC | 136 ms
54,080 KB |
testcase_16 | AC | 138 ms
54,300 KB |
testcase_17 | AC | 138 ms
54,020 KB |
testcase_18 | AC | 139 ms
54,408 KB |
testcase_19 | AC | 139 ms
54,448 KB |
testcase_20 | AC | 135 ms
54,268 KB |
testcase_21 | AC | 135 ms
54,472 KB |
testcase_22 | AC | 135 ms
54,192 KB |
testcase_23 | AC | 138 ms
54,524 KB |
testcase_24 | AC | 135 ms
54,076 KB |
testcase_25 | AC | 138 ms
54,156 KB |
testcase_26 | AC | 142 ms
54,344 KB |
ソースコード
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; } }