結果
問題 | No.492 IOI数列 |
ユーザー |
![]() |
提出日時 | 2017-03-11 00:19:05 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 2,102 bytes |
コンパイル時間 | 913 ms |
コンパイル使用メモリ | 114,428 KB |
実行使用メモリ | 771,276 KB |
最終ジャッジ日時 | 2024-06-24 09:15:57 |
合計ジャッジ時間 | 3,490 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 1 MLE * 1 -- * 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.Linq;using System.Collections.Generic;using System.Text.RegularExpressions;using System.Text;public class Program{public void Proc() {Reader.IsDebug = false;decimal num = decimal.Parse(Reader.ReadLine());Console.WriteLine(GetMod(1, num-1));decimal ans = 0;if(num%11>0) {ans = Get101Num(1, (int)(num%11)-1);}Console.WriteLine(ans);}private decimal Get101Num(decimal num, int keta) {if(keta == 0) {return num;}decimal tmp = num;for(int i=1; i<=keta; i++) {tmp = tmp * 100 + 1;}return tmp;}Dictionary<decimal, decimal> dic = new Dictionary<decimal, decimal>();private decimal GetMod(decimal num, decimal remain) {if(remain <= 5) {decimal num2 = Get101Num(num, (int)remain);return num2%mod1;}if(!dic.ContainsKey(num)) {dic.Add(num,remain);} else {decimal tmp = dic[num] - remain;decimal newRemain = remain % tmp;if(newRemain != remain) {return this.GetMod(num, newRemain);}}decimal target = Get101Num(num, (int)Math.Min(remain, 5));decimal newR = remain - Math.Min(remain, 5);return this.GetMod(target%mod1, newR);}private decimal mod1 = 1000000007;public class Reader {public static bool IsDebug = true;private static System.IO.StringReader SReader;private static string InitText = @"101";public static string ReadLine() {if(IsDebug) {if(SReader == null) {SReader = new System.IO.StringReader(InitText.Trim());}return SReader.ReadLine();} else {return Console.ReadLine();}}}public static void Main(string[] args){Program prg = new Program();prg.Proc();}}