結果
問題 | No.492 IOI数列 |
ユーザー |
![]() |
提出日時 | 2017-04-13 21:01:58 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 22 ms / 1,000 ms |
コード長 | 1,483 bytes |
コンパイル時間 | 2,346 ms |
コンパイル使用メモリ | 114,492 KB |
実行使用メモリ | 17,920 KB |
最終ジャッジ日時 | 2024-07-18 12:59:38 |
合計ジャッジ時間 | 3,503 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
コンパイルメッセージ
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 Program{static void Main(string[] args){new Magatro().Solve();}}public class Magatro{private long N;private int Mod = (int)1e9 + 7;private long[] Anser = new long[] { 0l, 1l, 101l, 10101l, 1010101l, 101010101l, 10101010101l, 1010101010101l,101010101010101l, 10101010101010101l, 1010101010101010101l };private void Scan(){N = long.Parse(Console.ReadLine());}private long Pow(long a, long b, long mod){long result = 1;while (b > 0){if (b % 2 == 1){result *= a;result %= mod;}a *= a;a %= mod;b /= 2;}return result;}private long Function(long i, long mod){if (i == 0){return 0;}if (i == 1){return 1;}if (i % 2 == 1){long res = Function(i - 1, mod) * 100 + 1;res %= mod;return res;}else{long res = Function(i / 2, mod);res *= Pow(100, i / 2, mod) + 1;res %= mod;return res;}}public void Solve(){Scan();Console.WriteLine(Function(N, Mod));Console.WriteLine(Anser[N % 11]);}}