結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,060 KB
testcase_01 AC 29 ms
10,060 KB
testcase_02 AC 29 ms
10,060 KB
testcase_03 AC 30 ms
10,060 KB
testcase_04 AC 29 ms
10,060 KB
testcase_05 AC 29 ms
10,060 KB
testcase_06 AC 29 ms
10,060 KB
testcase_07 AC 29 ms
10,060 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 WA -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

  p = p * 2

  o = 1
  for i in range(1, h):
    o = o * 10

  if l % 2 == 0:
    o = o * 10

  p = p - (p // 2) + o - 1

  return p

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