結果
問題 | No.491 10^9+1と回文 |
ユーザー | mkawa2 |
提出日時 | 2020-01-02 15:45:55 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 575 ms / 1,000 ms |
コード長 | 1,158 bytes |
コンパイル時間 | 100 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 45,060 KB |
最終ジャッジ日時 | 2024-05-19 12:23:26 |
合計ジャッジ時間 | 62,266 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 546 ms
44,920 KB |
testcase_01 | AC | 543 ms
44,924 KB |
testcase_02 | AC | 511 ms
44,792 KB |
testcase_03 | AC | 521 ms
45,060 KB |
testcase_04 | AC | 532 ms
44,916 KB |
testcase_05 | AC | 524 ms
44,788 KB |
testcase_06 | AC | 539 ms
44,664 KB |
testcase_07 | AC | 527 ms
44,788 KB |
testcase_08 | AC | 540 ms
44,668 KB |
testcase_09 | AC | 538 ms
44,772 KB |
testcase_10 | AC | 514 ms
44,796 KB |
testcase_11 | AC | 509 ms
44,664 KB |
testcase_12 | AC | 525 ms
44,920 KB |
testcase_13 | AC | 522 ms
44,704 KB |
testcase_14 | AC | 518 ms
44,788 KB |
testcase_15 | AC | 523 ms
44,792 KB |
testcase_16 | AC | 504 ms
44,804 KB |
testcase_17 | AC | 513 ms
44,796 KB |
testcase_18 | AC | 531 ms
44,796 KB |
testcase_19 | AC | 521 ms
45,048 KB |
testcase_20 | AC | 532 ms
45,052 KB |
testcase_21 | AC | 526 ms
45,048 KB |
testcase_22 | AC | 542 ms
45,052 KB |
testcase_23 | AC | 550 ms
44,796 KB |
testcase_24 | AC | 545 ms
44,932 KB |
testcase_25 | AC | 532 ms
44,788 KB |
testcase_26 | AC | 533 ms
44,920 KB |
testcase_27 | AC | 557 ms
44,920 KB |
testcase_28 | AC | 544 ms
44,920 KB |
testcase_29 | AC | 545 ms
44,660 KB |
testcase_30 | AC | 560 ms
44,792 KB |
testcase_31 | AC | 549 ms
44,916 KB |
testcase_32 | AC | 505 ms
44,800 KB |
testcase_33 | AC | 537 ms
44,660 KB |
testcase_34 | AC | 543 ms
44,920 KB |
testcase_35 | AC | 542 ms
44,668 KB |
testcase_36 | AC | 558 ms
44,664 KB |
testcase_37 | AC | 512 ms
44,812 KB |
testcase_38 | AC | 559 ms
44,788 KB |
testcase_39 | AC | 513 ms
44,788 KB |
testcase_40 | AC | 522 ms
44,920 KB |
testcase_41 | AC | 554 ms
44,916 KB |
testcase_42 | AC | 522 ms
44,920 KB |
testcase_43 | AC | 521 ms
44,792 KB |
testcase_44 | AC | 521 ms
44,668 KB |
testcase_45 | AC | 507 ms
44,932 KB |
testcase_46 | AC | 530 ms
44,664 KB |
testcase_47 | AC | 519 ms
44,660 KB |
testcase_48 | AC | 517 ms
44,936 KB |
testcase_49 | AC | 537 ms
44,800 KB |
testcase_50 | AC | 534 ms
44,928 KB |
testcase_51 | AC | 529 ms
44,804 KB |
testcase_52 | AC | 537 ms
44,868 KB |
testcase_53 | AC | 534 ms
44,808 KB |
testcase_54 | AC | 529 ms
44,920 KB |
testcase_55 | AC | 535 ms
44,920 KB |
testcase_56 | AC | 540 ms
44,796 KB |
testcase_57 | AC | 532 ms
44,916 KB |
testcase_58 | AC | 541 ms
44,664 KB |
testcase_59 | AC | 533 ms
44,792 KB |
testcase_60 | AC | 541 ms
44,916 KB |
testcase_61 | AC | 528 ms
44,920 KB |
testcase_62 | AC | 539 ms
44,920 KB |
testcase_63 | AC | 538 ms
44,792 KB |
testcase_64 | AC | 536 ms
44,924 KB |
testcase_65 | AC | 546 ms
44,796 KB |
testcase_66 | AC | 569 ms
44,796 KB |
testcase_67 | AC | 534 ms
44,664 KB |
testcase_68 | AC | 573 ms
44,792 KB |
testcase_69 | AC | 546 ms
44,788 KB |
testcase_70 | AC | 534 ms
44,660 KB |
testcase_71 | AC | 534 ms
44,788 KB |
testcase_72 | AC | 537 ms
44,792 KB |
testcase_73 | AC | 545 ms
44,772 KB |
testcase_74 | AC | 543 ms
44,664 KB |
testcase_75 | AC | 554 ms
44,920 KB |
testcase_76 | AC | 554 ms
44,920 KB |
testcase_77 | AC | 575 ms
44,816 KB |
testcase_78 | AC | 554 ms
44,924 KB |
testcase_79 | AC | 529 ms
44,804 KB |
testcase_80 | AC | 544 ms
44,920 KB |
testcase_81 | AC | 533 ms
44,920 KB |
testcase_82 | AC | 561 ms
44,808 KB |
testcase_83 | AC | 537 ms
44,792 KB |
testcase_84 | AC | 538 ms
44,768 KB |
testcase_85 | AC | 541 ms
44,920 KB |
testcase_86 | AC | 534 ms
44,920 KB |
testcase_87 | AC | 534 ms
44,536 KB |
testcase_88 | AC | 546 ms
44,788 KB |
testcase_89 | AC | 537 ms
44,664 KB |
testcase_90 | AC | 538 ms
44,788 KB |
testcase_91 | AC | 550 ms
44,672 KB |
testcase_92 | AC | 543 ms
44,804 KB |
testcase_93 | AC | 546 ms
44,796 KB |
testcase_94 | AC | 532 ms
44,792 KB |
testcase_95 | AC | 550 ms
44,676 KB |
testcase_96 | AC | 544 ms
44,916 KB |
testcase_97 | AC | 545 ms
44,776 KB |
testcase_98 | AC | 531 ms
44,796 KB |
testcase_99 | AC | 521 ms
44,920 KB |
testcase_100 | AC | 529 ms
44,792 KB |
testcase_101 | AC | 537 ms
44,868 KB |
testcase_102 | AC | 547 ms
44,660 KB |
testcase_103 | AC | 532 ms
44,796 KB |
testcase_104 | AC | 541 ms
44,664 KB |
testcase_105 | AC | 541 ms
44,788 KB |
ソースコード
from itertools import * from bisect import * #from math import * from collections import * from heapq import * from random import * from decimal import * import numpy as np import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def MI1(): return map(int1, sys.stdin.readline().split()) def MF(): return map(float, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LI1(): return list(map(int1, sys.stdin.readline().split())) def LF(): return list(map(float, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] dij = [(1, 0), (0, 1), (-1, 0), (0, -1)] def main(): s=input() n=int(s) if n<10**9+1: print(0) exit() k=len(s)-9 ans=0 for i in range(1,k): fw=(i+1)//2 ans+=10**fw-10**(fw-1) #print(i,10**fw-10**(fw-1)) ans+=int(s[:(k+1)//2])-(10**((k-1)//2)-1) sym=int(s[:(k+1)//2]+s[:k//2][::-1])*1000000001 if sym>n:ans-=1 print(ans) main()