結果
| 問題 |
No.554 recurrence formula
|
| コンテスト | |
| ユーザー |
Risen
|
| 提出日時 | 2017-08-11 22:59:22 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 637 bytes |
| コンパイル時間 | 906 ms |
| コンパイル使用メモリ | 104,832 KB |
| 実行使用メモリ | 22,784 KB |
| 最終ジャッジ日時 | 2024-10-12 21:39:48 |
| 合計ジャッジ時間 | 10,037 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 TLE * 1 -- * 1 |
コンパイルメッセージ
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;
class Solution
{
static Dictionary<int, long> dict = new Dictionary<int, long>() { { 1, 1 } };
static long F(int n)
{
if (dict.ContainsKey(n))
{
return dict[n];
}
long v = 0;
for (int i = n % 2 + 1; i <= n - 1; i += 2)
{
v += F(i);
v %= 1000000000 + 7;
}
v *= n;
v %= 1000000000 + 7;
dict[n] = v;
return v;
}
static void Main()
{
var n = int.Parse(Console.ReadLine());
Console.WriteLine(F(n));
}
}
Risen