結果

問題 No.458 異なる素数の和
ユーザー MaboyMaboy
提出日時 2017-04-26 14:23:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 1,522 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 8,828 KB
最終ジャッジ日時 2023-10-11 13:46:52
合計ジャッジ時間 2,342 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
8,736 KB
testcase_01 AC 30 ms
8,764 KB
testcase_02 AC 30 ms
8,728 KB
testcase_03 AC 30 ms
8,684 KB
testcase_04 AC 30 ms
8,804 KB
testcase_05 AC 30 ms
8,712 KB
testcase_06 AC 30 ms
8,680 KB
testcase_07 AC 30 ms
8,628 KB
testcase_08 AC 31 ms
8,788 KB
testcase_09 AC 31 ms
8,720 KB
testcase_10 AC 31 ms
8,684 KB
testcase_11 AC 31 ms
8,668 KB
testcase_12 AC 30 ms
8,628 KB
testcase_13 AC 30 ms
8,672 KB
testcase_14 AC 30 ms
8,628 KB
testcase_15 AC 30 ms
8,712 KB
testcase_16 AC 30 ms
8,788 KB
testcase_17 AC 30 ms
8,688 KB
testcase_18 AC 30 ms
8,680 KB
testcase_19 AC 30 ms
8,788 KB
testcase_20 AC 30 ms
8,672 KB
testcase_21 AC 30 ms
8,628 KB
testcase_22 AC 30 ms
8,708 KB
testcase_23 AC 30 ms
8,628 KB
testcase_24 AC 29 ms
8,704 KB
testcase_25 AC 30 ms
8,716 KB
testcase_26 AC 30 ms
8,684 KB
testcase_27 AC 30 ms
8,680 KB
testcase_28 AC 29 ms
8,732 KB
testcase_29 AC 29 ms
8,696 KB
testcase_30 AC 30 ms
8,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s="!B#%!!A&$!!/#>!!.#$!!-.2!!,.1!!+2.!!*oug!!)ftzh!!(eoj$!!'oue$!!&gbs#!#?=;@:@$>;?%$-/$2eyg.5A5/(5/$B$10&%$.8ouh4'+14A,okj$2eye$14*-0*+2frx#eem23*5-3'+29Abuph#pea$4.30'Bxwm32*..36oue</(38'+44A47'5.44A50'2eye$47oue<4'53'B$2syn53*4B$58&%(59oue<2/$3.64&%(6okl+71*.5.69'Bpnw74*.5.74*+8frx#eem+80oue<2/$6.8frx#xwm89'3.#febt2A2syn3#tse3/$#<3A+9frw#<ftpl$+99'2#dljx..99A.8.99'2gnhl101oui,04&%(110)2A2fxjx110*#eem119*Bxwn21*2fxjx+121&%$,28*5hyan/(134Apxs34)2Apxs34)4'2yqe0/(#<Ayqe0/xwm-#<'2yqe0/(#<A4yqe0/$#<4'2fxjx149*#dxwv159)2A2#pnx58Ahwxa6okj$2fxjx11,5okl.3,69)#pea$#xwn70*B$3.4,7jpez%eoi.,78'Bpnx8frwB$cizl.5,76)/(188'#<ouh9jpfa/$#pnw5,88)2&%$4pxs93&<frxBldir94)2#dzaj4-00&%(206*4-1jpez$Bbufl1frwB$#eoi16)/(218'2krpl4-1oki+krpl221'2#dljx.5-1okj<3'202/"
while s[0]=="!":
  fs=s[1]
  ns=s[2:s.index("!",2)]
  s=s[s.index("!",2)+1:].replace(fs,ns)
  
i=len(s)
c=0
cd=0
while i>0:
  i-=1
  if 'a'<=s[i]<='z':
    c+=1
  elif c>0:
    i+=1
    cds=s[i:i+c]
    cd=0
    for c,j in enumerate(reversed(cds)):
      cd+=(ord(j)-97)*26**c
    c=0
    m=cd>>8
    n=cd&255
    sc=s[m:m+n]
    s=s[:i]+sc+s[i+len(cds):]

i=0
c=0
while i<len(s):
  if '0'<=s[i]<='9':
    c+=1
  elif c>0:
    v=int(s[i-c:i])
    s=s[:i-c]+s[i]*v+s[i+1:]
    i+=v-c-1
    c=0
  i+=1

L=list(">< == <>".split())
l=""
for i in range(len(L)):
  s=s.replace(chr(35+i),L[i])
s="".join([chr(ord(x)-10) for x in s])

L=[int(x) for x in s]
L=list(map(lambda x:x-3, L))
for i in range(len(L)-1):
  L[i+1]+=L[i]
L=list(map(lambda x:x-1, L))

print(L[int(input())])
0