結果

問題 No.491 10^9+1と回文
ユーザー 14番14番
提出日時 2017-03-10 23:18:38
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,093 bytes
コンパイル時間 2,377 ms
コンパイル使用メモリ 104,732 KB
実行使用メモリ 55,872 KB
最終ジャッジ日時 2023-09-06 14:14:01
合計ジャッジ時間 13,679 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 101 ms
25,612 KB
testcase_04 AC 69 ms
21,044 KB
testcase_05 AC 85 ms
23,420 KB
testcase_06 AC 326 ms
53,088 KB
testcase_07 AC 64 ms
20,660 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 59 ms
22,704 KB
testcase_12 AC 60 ms
20,800 KB
testcase_13 WA -
testcase_14 AC 64 ms
21,064 KB
testcase_15 AC 60 ms
20,752 KB
testcase_16 AC 59 ms
22,876 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 58 ms
20,604 KB
testcase_20 WA -
testcase_21 AC 59 ms
20,656 KB
testcase_22 WA -
testcase_23 AC 63 ms
21,072 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 62 ms
20,748 KB
testcase_31 WA -
testcase_32 AC 62 ms
22,776 KB
testcase_33 WA -
testcase_34 AC 59 ms
18,796 KB
testcase_35 AC 60 ms
18,796 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 62 ms
20,840 KB
testcase_39 AC 61 ms
20,784 KB
testcase_40 WA -
testcase_41 AC 59 ms
20,800 KB
testcase_42 AC 61 ms
20,784 KB
testcase_43 AC 60 ms
20,664 KB
testcase_44 AC 59 ms
20,728 KB
testcase_45 AC 62 ms
20,676 KB
testcase_46 AC 59 ms
20,676 KB
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 AC 61 ms
20,676 KB
testcase_51 AC 64 ms
20,768 KB
testcase_52 AC 65 ms
20,680 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 AC 68 ms
20,744 KB
testcase_58 AC 72 ms
19,004 KB
testcase_59 AC 68 ms
20,756 KB
testcase_60 AC 68 ms
20,744 KB
testcase_61 WA -
testcase_62 AC 68 ms
20,724 KB
testcase_63 AC 72 ms
20,760 KB
testcase_64 AC 68 ms
22,704 KB
testcase_65 WA -
testcase_66 WA -
testcase_67 AC 134 ms
31,972 KB
testcase_68 AC 62 ms
20,752 KB
testcase_69 WA -
testcase_70 WA -
testcase_71 AC 62 ms
20,768 KB
testcase_72 AC 58 ms
18,680 KB
testcase_73 AC 60 ms
22,796 KB
testcase_74 AC 60 ms
18,736 KB
testcase_75 WA -
testcase_76 WA -
testcase_77 WA -
testcase_78 AC 58 ms
20,724 KB
testcase_79 AC 60 ms
20,836 KB
testcase_80 WA -
testcase_81 WA -
testcase_82 WA -
testcase_83 AC 64 ms
22,712 KB
testcase_84 WA -
testcase_85 AC 59 ms
20,736 KB
testcase_86 WA -
testcase_87 AC 58 ms
20,772 KB
testcase_88 WA -
testcase_89 AC 58 ms
22,756 KB
testcase_90 AC 58 ms
22,724 KB
testcase_91 AC 58 ms
20,716 KB
testcase_92 WA -
testcase_93 AC 60 ms
22,808 KB
testcase_94 AC 60 ms
20,764 KB
testcase_95 WA -
testcase_96 AC 59 ms
20,772 KB
testcase_97 AC 129 ms
34,316 KB
testcase_98 AC 322 ms
53,468 KB
testcase_99 AC 278 ms
52,696 KB
testcase_100 AC 285 ms
53,616 KB
testcase_101 AC 234 ms
50,880 KB
testcase_102 AC 240 ms
47,760 KB
testcase_103 AC 324 ms
55,872 KB
testcase_104 AC 333 ms
52,948 KB
testcase_105 AC 335 ms
53,460 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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 inpt = decimal.Parse(Reader.ReadLine());
        this.max = inpt;

        long ans = 0;
        for(int i=0; i<=9; i++) {
            ans += GetNum(i.ToString());
            ans += GetNum(i.ToString()+i);
        }
        Console.WriteLine(ans);
    }

    private Dictionary<string, bool> flag = new Dictionary<string, bool>();

    private Dictionary<decimal, bool> flagNum = new Dictionary<decimal, bool>();
    private long GetNum(string tmp) {
        if(flag.ContainsKey(tmp)) {
            return 0;
        }
        flag[tmp] = true;
        decimal num = decimal.Parse(tmp);

        if(num*baseNum > max) {
            return -1;
        }
        if(tmp.Length >= 10) {
            return -1;
        }

        long ans = 0;
        if(!flagNum.ContainsKey(num)) {
            if(num > 0 && num.ToString().Length == tmp.Length) {
                ans++;
            }
            flagNum[num] = true;
        }
        for(int i=0; i<=9; i++) {
            long ret = GetNum(i + tmp + i);
            if(ret >= 0) {
                ans+=ret;
            }  else {
                break;
            }
        }
        return ans;
    }

    private decimal max = 0;

    private decimal baseNum = 1000000000 + 1;





    public class Reader {
        public static bool IsDebug = true;
        private static System.IO.StringReader SReader;
        private static string InitText = @"


40000000000


";
        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();
    }
}
0