結果

問題 No.528 10^9と10^9+7と回文
ユーザー vvataarnevvataarne
提出日時 2017-06-10 00:12:17
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 473 bytes
コンパイル時間 631 ms
コンパイル使用メモリ 7,060 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2023-10-24 03:44:12
合計ジャッジ時間 3,460 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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