結果

問題 No.491 10^9+1と回文
ユーザー omi_UTomi_UT
提出日時 2017-03-10 23:23:24
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,619 bytes
コンパイル時間 3,204 ms
コンパイル使用メモリ 74,648 KB
実行使用メモリ 52,612 KB
最終ジャッジ日時 2023-09-06 14:16:00
合計ジャッジ時間 11,026 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
50,412 KB
testcase_01 AC 54 ms
50,020 KB
testcase_02 AC 53 ms
49,960 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 53 ms
50,420 KB
testcase_10 AC 53 ms
50,156 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 53 ms
50,148 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 54 ms
50,148 KB
testcase_21 WA -
testcase_22 AC 54 ms
50,208 KB
testcase_23 WA -
testcase_24 AC 54 ms
50,212 KB
testcase_25 WA -
testcase_26 AC 54 ms
50,516 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 55 ms
50,212 KB
testcase_30 WA -
testcase_31 AC 53 ms
50,264 KB
testcase_32 WA -
testcase_33 AC 53 ms
49,968 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 55 ms
50,156 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 54 ms
49,968 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 53 ms
49,964 KB
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 AC 53 ms
50,484 KB
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 AC 54 ms
50,204 KB
testcase_61 AC 54 ms
50,204 KB
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 AC 53 ms
48,176 KB
testcase_67 WA -
testcase_68 WA -
testcase_69 AC 54 ms
50,080 KB
testcase_70 WA -
testcase_71 WA -
testcase_72 WA -
testcase_73 WA -
testcase_74 WA -
testcase_75 AC 55 ms
50,068 KB
testcase_76 WA -
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
testcase_80 AC 53 ms
50,420 KB
testcase_81 AC 53 ms
50,124 KB
testcase_82 WA -
testcase_83 WA -
testcase_84 AC 54 ms
50,568 KB
testcase_85 WA -
testcase_86 AC 53 ms
50,168 KB
testcase_87 WA -
testcase_88 AC 53 ms
50,092 KB
testcase_89 WA -
testcase_90 WA -
testcase_91 WA -
testcase_92 AC 54 ms
50,032 KB
testcase_93 WA -
testcase_94 WA -
testcase_95 AC 53 ms
50,632 KB
testcase_96 AC 53 ms
50,300 KB
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[110001];
		for(int i=1;i<10;i++){
			kaibun[i] = i;
			kaibun[9+i] = 10*i+i;
		} //20
		for(int i=1; i<10; i++){
			for(int j=0;j<10;j++){
				kaibun[9 + 10*i+j] = 101*i+10*j;
				kaibun[99 + 10*i+j] = 1001*i+110*j;
			}
		}//200
		for(int i=1; i<10; i++){
			for(int j=0;j<10;j++){
				for(int k=0; k<10;k++){
					kaibun[89 + 100*i+10*j+k] = 10001*i+1010*j+100*k ;
					kaibun[989 + 100*i+10*j+k] = 100001*i+10010*j+1100*k;
				}
			}
		}//2000
		for(int i=1; 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[889 + 1000*i+100*j+10*k+l] = 1000001*i+100010*j+10100*k+1000*l ;
						kaibun[9889 +1000*i+100*j+10*k+l] = 10000001*i+1000010*j+100100*k+11000*l ;
					}
				}
			}
		}//20000
		for(int i=1; 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[8889 + 10000*i+1000*j+100*k+10*l+m] = 10000001*i+1000010*j+100100*k+101000*l+10000*m ;
						}
					}
				}
			}
		}//110000
		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