結果

問題 No.491 10^9+1と回文
ユーザー fgwiebfaoishfgwiebfaoish
提出日時 2020-03-25 03:58:29
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 1,000 ms
コード長 2,956 bytes
コンパイル時間 4,272 ms
コンパイル使用メモリ 106,296 KB
実行使用メモリ 22,956 KB
最終ジャッジ日時 2023-08-30 09:19:51
合計ジャッジ時間 15,166 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
22,784 KB
testcase_01 AC 58 ms
20,780 KB
testcase_02 AC 59 ms
20,660 KB
testcase_03 AC 60 ms
22,752 KB
testcase_04 AC 57 ms
18,728 KB
testcase_05 AC 58 ms
20,732 KB
testcase_06 AC 58 ms
20,836 KB
testcase_07 AC 59 ms
20,804 KB
testcase_08 AC 58 ms
18,744 KB
testcase_09 AC 58 ms
20,836 KB
testcase_10 AC 58 ms
22,692 KB
testcase_11 AC 59 ms
20,716 KB
testcase_12 AC 58 ms
20,784 KB
testcase_13 AC 58 ms
20,740 KB
testcase_14 AC 58 ms
20,820 KB
testcase_15 AC 58 ms
20,792 KB
testcase_16 AC 58 ms
20,772 KB
testcase_17 AC 58 ms
20,804 KB
testcase_18 AC 58 ms
20,828 KB
testcase_19 AC 57 ms
20,712 KB
testcase_20 AC 58 ms
20,716 KB
testcase_21 AC 58 ms
20,708 KB
testcase_22 AC 57 ms
20,792 KB
testcase_23 AC 58 ms
20,776 KB
testcase_24 AC 58 ms
20,720 KB
testcase_25 AC 58 ms
20,884 KB
testcase_26 AC 57 ms
20,736 KB
testcase_27 AC 57 ms
20,896 KB
testcase_28 AC 57 ms
20,796 KB
testcase_29 AC 57 ms
22,836 KB
testcase_30 AC 57 ms
18,884 KB
testcase_31 AC 57 ms
22,768 KB
testcase_32 AC 58 ms
22,696 KB
testcase_33 AC 59 ms
18,736 KB
testcase_34 AC 59 ms
20,888 KB
testcase_35 AC 58 ms
20,660 KB
testcase_36 AC 58 ms
20,788 KB
testcase_37 AC 59 ms
20,828 KB
testcase_38 AC 58 ms
20,832 KB
testcase_39 AC 58 ms
20,728 KB
testcase_40 AC 58 ms
20,888 KB
testcase_41 AC 58 ms
20,796 KB
testcase_42 AC 58 ms
20,912 KB
testcase_43 AC 59 ms
20,716 KB
testcase_44 AC 58 ms
20,772 KB
testcase_45 AC 58 ms
20,720 KB
testcase_46 AC 58 ms
20,792 KB
testcase_47 AC 58 ms
20,808 KB
testcase_48 AC 56 ms
20,840 KB
testcase_49 AC 58 ms
20,668 KB
testcase_50 AC 57 ms
22,900 KB
testcase_51 AC 57 ms
20,760 KB
testcase_52 AC 57 ms
20,808 KB
testcase_53 AC 58 ms
22,768 KB
testcase_54 AC 58 ms
22,876 KB
testcase_55 AC 58 ms
22,832 KB
testcase_56 AC 57 ms
20,780 KB
testcase_57 AC 59 ms
20,772 KB
testcase_58 AC 57 ms
20,668 KB
testcase_59 AC 58 ms
22,836 KB
testcase_60 AC 58 ms
20,856 KB
testcase_61 AC 57 ms
18,732 KB
testcase_62 AC 58 ms
20,796 KB
testcase_63 AC 58 ms
20,800 KB
testcase_64 AC 58 ms
20,848 KB
testcase_65 AC 57 ms
20,776 KB
testcase_66 AC 57 ms
18,680 KB
testcase_67 AC 58 ms
22,764 KB
testcase_68 AC 58 ms
20,852 KB
testcase_69 AC 57 ms
20,788 KB
testcase_70 AC 58 ms
20,724 KB
testcase_71 AC 58 ms
20,696 KB
testcase_72 AC 58 ms
20,788 KB
testcase_73 AC 58 ms
20,680 KB
testcase_74 AC 57 ms
22,776 KB
testcase_75 AC 59 ms
20,800 KB
testcase_76 AC 58 ms
22,764 KB
testcase_77 AC 58 ms
22,784 KB
testcase_78 AC 58 ms
22,832 KB
testcase_79 AC 59 ms
20,644 KB
testcase_80 AC 58 ms
20,720 KB
testcase_81 AC 58 ms
20,732 KB
testcase_82 AC 58 ms
20,728 KB
testcase_83 AC 58 ms
20,704 KB
testcase_84 AC 58 ms
18,852 KB
testcase_85 AC 58 ms
20,808 KB
testcase_86 AC 57 ms
20,712 KB
testcase_87 AC 59 ms
22,796 KB
testcase_88 AC 58 ms
20,728 KB
testcase_89 AC 59 ms
20,828 KB
testcase_90 AC 58 ms
22,820 KB
testcase_91 AC 57 ms
20,888 KB
testcase_92 AC 57 ms
20,880 KB
testcase_93 AC 57 ms
20,796 KB
testcase_94 AC 58 ms
20,904 KB
testcase_95 AC 58 ms
22,744 KB
testcase_96 AC 58 ms
20,704 KB
testcase_97 AC 58 ms
20,784 KB
testcase_98 AC 59 ms
22,660 KB
testcase_99 AC 58 ms
22,752 KB
testcase_100 AC 58 ms
20,908 KB
testcase_101 AC 59 ms
22,956 KB
testcase_102 AC 58 ms
20,680 KB
testcase_103 AC 59 ms
20,840 KB
testcase_104 AC 58 ms
22,768 KB
testcase_105 AC 59 ms
20,656 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.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.L/1000000001;
		var t=n.ToString();
		int m=t.Length;
		long ans=0,d=9;
		for(int i = 0;i<m-1;i++) {
			ans+=d;
			if((i&1)==1){d*=10;}
		}
		var bo=true;
		d=1;
		for(int i = ((m+1)>>1)-1;i>=0;i--,d*=10) {
			if(bo&&t[i]<t[m-i-1]){ans++;bo=false;}
			else if(t[i]>t[m-i-1]){bo=false;}
			ans+=d*(t[i]-'0'-(i==0?1:0));
		}
		if(bo){ans++;}
		Console.WriteLine("{0}",ans);
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}
0