結果

問題 No.491 10^9+1と回文
ユーザー 6soukiti296soukiti29
提出日時 2017-03-21 22:07:27
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
RE  
実行時間 -
コード長 614 bytes
コンパイル時間 117 ms
コンパイル使用メモリ 10,860 KB
実行使用メモリ 7,960 KB
最終ジャッジ日時 2023-09-18 15:35:55
合計ジャッジ時間 5,184 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 16 ms
7,744 KB
testcase_04 AC 16 ms
7,904 KB
testcase_05 WA -
testcase_06 AC 15 ms
7,752 KB
testcase_07 AC 16 ms
7,764 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 16 ms
7,904 KB
testcase_11 WA -
testcase_12 AC 15 ms
7,824 KB
testcase_13 AC 15 ms
7,812 KB
testcase_14 AC 15 ms
7,744 KB
testcase_15 AC 16 ms
7,764 KB
testcase_16 AC 16 ms
7,856 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 16 ms
7,892 KB
testcase_20 RE -
testcase_21 AC 15 ms
7,908 KB
testcase_22 RE -
testcase_23 AC 16 ms
7,768 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 15 ms
7,752 KB
testcase_27 AC 16 ms
7,816 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 WA -
testcase_31 AC 16 ms
7,752 KB
testcase_32 WA -
testcase_33 RE -
testcase_34 AC 16 ms
7,752 KB
testcase_35 WA -
testcase_36 AC 16 ms
7,836 KB
testcase_37 RE -
testcase_38 WA -
testcase_39 AC 16 ms
7,928 KB
testcase_40 AC 16 ms
7,760 KB
testcase_41 AC 16 ms
7,912 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 15 ms
7,908 KB
testcase_45 WA -
testcase_46 AC 15 ms
7,900 KB
testcase_47 RE -
testcase_48 AC 16 ms
7,912 KB
testcase_49 AC 16 ms
7,912 KB
testcase_50 AC 15 ms
7,748 KB
testcase_51 WA -
testcase_52 AC 16 ms
7,872 KB
testcase_53 AC 16 ms
7,820 KB
testcase_54 AC 16 ms
7,756 KB
testcase_55 AC 15 ms
7,756 KB
testcase_56 RE -
testcase_57 AC 15 ms
7,804 KB
testcase_58 AC 16 ms
7,792 KB
testcase_59 AC 16 ms
7,796 KB
testcase_60 WA -
testcase_61 RE -
testcase_62 AC 15 ms
7,912 KB
testcase_63 AC 16 ms
7,944 KB
testcase_64 WA -
testcase_65 AC 15 ms
7,812 KB
testcase_66 RE -
testcase_67 AC 16 ms
7,752 KB
testcase_68 WA -
testcase_69 AC 15 ms
7,776 KB
testcase_70 RE -
testcase_71 AC 16 ms
7,752 KB
testcase_72 AC 15 ms
7,904 KB
testcase_73 AC 16 ms
7,800 KB
testcase_74 AC 15 ms
7,748 KB
testcase_75 RE -
testcase_76 AC 15 ms
7,824 KB
testcase_77 RE -
testcase_78 AC 16 ms
7,752 KB
testcase_79 AC 16 ms
7,804 KB
testcase_80 AC 16 ms
7,768 KB
testcase_81 RE -
testcase_82 AC 16 ms
7,800 KB
testcase_83 AC 15 ms
7,756 KB
testcase_84 RE -
testcase_85 AC 16 ms
7,796 KB
testcase_86 RE -
testcase_87 WA -
testcase_88 AC 16 ms
7,760 KB
testcase_89 AC 16 ms
7,844 KB
testcase_90 AC 16 ms
7,796 KB
testcase_91 AC 16 ms
7,756 KB
testcase_92 RE -
testcase_93 AC 16 ms
7,860 KB
testcase_94 WA -
testcase_95 RE -
testcase_96 WA -
testcase_97 AC 16 ms
7,940 KB
testcase_98 WA -
testcase_99 WA -
testcase_100 WA -
testcase_101 AC 15 ms
7,856 KB
testcase_102 WA -
testcase_103 WA -
testcase_104 WA -
testcase_105 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def kaibun(y):
	x = len(str(y))
	X = [9,9]
	i = 2
	while x > i:
		if i % 2 == 0:
			X.append(X[i - 1] * 10)
		else:
			X.append(X[i - 1])
		i = i + 1
	a = sum(X[:x - 1])
	for j in range(1, x // 2 + 1):
		if j == 1:
			a = a + (int(str(y)[j - 1]) - 1) * X[x - 2 * j + 1]//9
		else:
			a = a + (int(str(y)[j - 1])) * X[x - 2 * j + 1] // 9
	if int(str(y)[:x//2][::-1]) < int(str(y)[x//2:]) and x % 2 == 0:
		a = a + 1
	elif int(str(y)[:x//2][::-1]) < int(str(y)[x//2 + 1:]) and x % 2 == 1:
		a = a + 1 + int(str(y)[x//2])
	return a
n = input()
if len(n) < 10:
	print(0)
else:
	n = n[:-9]
	n = int(n)
	print(kaibun(n))
0