結果
問題 | No.314 ケンケンパ |
ユーザー |
|
提出日時 | 2017-05-20 14:17:58 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 63 ms / 1,000 ms |
コード長 | 660 bytes |
コンパイル時間 | 870 ms |
コンパイル使用メモリ | 106,124 KB |
実行使用メモリ | 18,048 KB |
最終ジャッジ日時 | 2024-09-19 00:27:36 |
合計ジャッジ時間 | 2,311 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
コンパイルメッセージ
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.Generic;using System.Linq;public class Program{public static void Main() {long mod = (long)Math.Pow(10, 9) + 7;long N = int.Parse(Console.ReadLine());var bp = new long[2, 3];bp[0, 0] = 1;bp[0, 1] = 0;bp[0, 2] = 0;for (int i = 1; i < N; i++) {bp[1, 0] = bp[0, 2];bp[1, 1] = bp[0, 0];bp[1, 2] = (bp[0, 0] + bp[0, 1]) % mod;bp[0, 0] = bp[1, 0];bp[0, 1] = bp[1, 1];bp[0, 2] = bp[1, 2];}Console.WriteLine((bp[0, 0] + bp[0, 1] + bp[0, 2]) % mod);}}