結果

問題 No.528 10^9と10^9+7と回文
ユーザー vvataarnevvataarne
提出日時 2017-06-10 00:02:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 516 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 11,856 KB
実行使用メモリ 10,288 KB
最終ジャッジ日時 2023-10-24 03:30:10
合計ジャッジ時間 1,871 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
9,948 KB
testcase_01 AC 29 ms
9,948 KB
testcase_02 AC 29 ms
9,948 KB
testcase_03 AC 30 ms
9,948 KB
testcase_04 AC 29 ms
9,948 KB
testcase_05 AC 29 ms
9,948 KB
testcase_06 AC 30 ms
9,948 KB
testcase_07 AC 29 ms
9,948 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 WA -
testcase_23 WA -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

def g(p, n):
  a = p
  b = 0
  
  if n % 2 == 1:
    p = int(p / 10)
  
  while p != 0:
    d = p
    p = int(p / 10)
    b = b * 10 + d
    a = a * 10
  
  return a + b

def f(n):
  l = len(str(n))
  h = int((l + 1) / 2)
  p = int(str(n)[0:h])
  
  if g(p, l) > n:
    p = p - 1

  p = p * 2

  if l % 2 == 1:
    o = int(pow(10, h - 1))
    p = p - int(p / 2) + o - 1
  else:
    o = int(pow(10, h))
    p = p - int(p / 2) + o - 1

  return p

n = int(input())
x = f(n)
print(x % 1000000000)
print(x % 1000000007)
0