結果

問題 No.491 10^9+1と回文
ユーザー omi_UTomi_UT
提出日時 2017-03-10 23:27:50
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,626 bytes
コンパイル時間 2,912 ms
コンパイル使用メモリ 73,960 KB
実行使用メモリ 52,120 KB
最終ジャッジ日時 2023-09-06 14:23:50
合計ジャッジ時間 10,191 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
50,176 KB
testcase_01 AC 45 ms
50,376 KB
testcase_02 AC 47 ms
50,056 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 48 ms
50,044 KB
testcase_10 AC 48 ms
50,336 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 49 ms
50,044 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 46 ms
50,076 KB
testcase_21 WA -
testcase_22 AC 48 ms
50,020 KB
testcase_23 WA -
testcase_24 AC 50 ms
48,548 KB
testcase_25 WA -
testcase_26 AC 54 ms
50,284 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 51 ms
50,240 KB
testcase_30 WA -
testcase_31 AC 48 ms
50,092 KB
testcase_32 WA -
testcase_33 AC 49 ms
50,188 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 47 ms
50,136 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 46 ms
50,144 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 AC 44 ms
50,236 KB
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 AC 46 ms
50,180 KB
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 AC 45 ms
50,328 KB
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 AC 45 ms
50,012 KB
testcase_70 WA -
testcase_71 WA -
testcase_72 WA -
testcase_73 WA -
testcase_74 WA -
testcase_75 AC 45 ms
49,964 KB
testcase_76 WA -
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
testcase_80 AC 46 ms
50,248 KB
testcase_81 AC 45 ms
50,096 KB
testcase_82 WA -
testcase_83 WA -
testcase_84 AC 46 ms
50,520 KB
testcase_85 WA -
testcase_86 AC 47 ms
50,012 KB
testcase_87 WA -
testcase_88 AC 48 ms
50,420 KB
testcase_89 WA -
testcase_90 WA -
testcase_91 WA -
testcase_92 AC 46 ms
50,288 KB
testcase_93 WA -
testcase_94 WA -
testcase_95 AC 49 ms
50,408 KB
testcase_96 WA -
testcase_97 WA -
testcase_98 WA -
testcase_99 WA -
testcase_100 WA -
testcase_101 WA -
testcase_102 WA -
testcase_103 WA -
testcase_104 WA -
testcase_105 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		long n = Long.parseLong(br.readLine());
		int big = (int) (n/1000000000);
		int small = (int) (n%1000000000);

		int ans = 0;
		int[] kaibun = new int[122221];
		for(int i=0;i<10;i++){
			kaibun[i] = i;
			kaibun[9+i] = 10*i+i;
		} //20
		for(int i=0; i<10; i++){
			for(int j=0;j<10;j++){
				kaibun[20 + 10*i+j] = 101*i+10*j;
				kaibun[120 + 10*i+j] = 1001*i+110*j;
			}
		}//220
		for(int i=0; i<10; i++){
			for(int j=0;j<10;j++){
				for(int k=0; k<10;k++){
					kaibun[220 + 100*i+10*j+k] = 10001*i+1010*j+100*k ;
					kaibun[1220 + 100*i+10*j+k] = 100001*i+10010*j+1100*k;
				}
			}
		}//2220
		for(int i=0; i<10; i++){
			for(int j=0;j<10;j++){
				for(int k=0; k<10;k++){
					for(int l=0;l<10;l++){
						kaibun[2220 + 1000*i+100*j+10*k+l] = 1000001*i+100010*j+10100*k+1000*l ;
						kaibun[12220 +1000*i+100*j+10*k+l] = 10000001*i+1000010*j+100100*k+11000*l ;
					}
				}
			}
		}//22220
		for(int i=0; i<10; i++){
			for(int j=0;j<10;j++){
				for(int k=0; k<10;k++){
					for(int l=0;l<10;l++){
						for(int m=0; m<10; m++){
						kaibun[22220 + 10000*i+1000*j+100*k+10*l+m] = 10000001*i+1000010*j+100100*k+101000*l+10000*m ;
						}
					}
				}
			}
		}//122220
		ans = Arrays.binarySearch(kaibun, big);
		if (ans<0){ans = -ans -1;}
		if (Math.abs(Arrays.binarySearch(kaibun, small)) < ans) ans--;
		System.out.println(ans);
	}
}
0