結果
問題 | No.87 Advent Calendar Problem |
ユーザー |
![]() |
提出日時 | 2017-01-07 20:53:54 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 24 ms / 5,000 ms |
コード長 | 1,011 bytes |
コンパイル時間 | 1,026 ms |
コンパイル使用メモリ | 111,860 KB |
実行使用メモリ | 27,856 KB |
最終ジャッジ日時 | 2024-12-17 17:09:13 |
合計ジャッジ時間 | 2,447 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; class Magatro { static long N = long.Parse(Console.ReadLine()); static void Main() { long year = N - 2014; long cnt = 0; long loop = year / 400; long amari = year % 400; long a = 0; for(int i = 2014+1; i <=2014+ 400; i++) { if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) { cnt++; } cnt++; if (cnt % 7 == 0) { a++; } } long ans = a * loop; for(int i = 2014 + 1; i <= amari + 2014; i++) { if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) { cnt++; } cnt++; if (cnt % 7 == 0) ans++; } Console.WriteLine(ans); } }