結果

問題 No.6 使いものにならないハッシュ
ユーザー pluto77pluto77
提出日時 2016-08-17 10:12:59
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 489 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 7,168 KB
最終ジャッジ日時 2024-04-25 08:19:51
合計ジャッジ時間 12,311 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
6,144 KB
testcase_01 AC 10 ms
6,272 KB
testcase_02 AC 748 ms
7,168 KB
testcase_03 AC 75 ms
6,400 KB
testcase_04 AC 134 ms
6,528 KB
testcase_05 WA -
testcase_06 AC 379 ms
6,656 KB
testcase_07 AC 219 ms
6,400 KB
testcase_08 AC 349 ms
6,528 KB
testcase_09 AC 143 ms
6,272 KB
testcase_10 WA -
testcase_11 AC 86 ms
6,400 KB
testcase_12 AC 459 ms
6,912 KB
testcase_13 AC 83 ms
6,272 KB
testcase_14 AC 145 ms
6,400 KB
testcase_15 AC 364 ms
6,912 KB
testcase_16 AC 281 ms
6,400 KB
testcase_17 AC 606 ms
6,784 KB
testcase_18 AC 756 ms
7,168 KB
testcase_19 AC 576 ms
6,656 KB
testcase_20 AC 478 ms
6,656 KB
testcase_21 AC 47 ms
6,272 KB
testcase_22 AC 533 ms
6,656 KB
testcase_23 AC 459 ms
6,784 KB
testcase_24 AC 498 ms
6,656 KB
testcase_25 AC 266 ms
6,528 KB
testcase_26 AC 638 ms
6,912 KB
testcase_27 AC 488 ms
6,784 KB
testcase_28 AC 251 ms
6,656 KB
testcase_29 AC 670 ms
7,168 KB
testcase_30 WA -
testcase_31 AC 514 ms
6,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding: utf-8
#yuki_6

def is_prime(n):
 i=2
 while i*i<=n:
  if n%i==0:
   return False
  i+=1
 return True
 
def fhash(n):
 v=n
 while v>=10:
  v=v/10+v%10
 return v

k=int(raw_input())
n=int(raw_input())

if k==1 or k==2: k=3
p=[]
h=[]

for i in xrange(k,n+1):
 if is_prime(i):
  p.append(i)
  h.append(fhash(i))

res=0
maxl=0
for i in xrange(len(p)):
 ref=[False]*10
 for j in xrange(i,len(p)):
  if ref[h[j]]: break
  ref[h[j]]=True
 if maxl<=j-i:
  maxl=j-i
  res=p[i]
  
print res
0