結果

問題 No.6 使いものにならないハッシュ
ユーザー gigurururugigurururu
提出日時 2014-11-04 16:19:29
言語 Ruby
(3.3.0)
結果
AC  
実行時間 203 ms / 5,000 ms
コード長 317 bytes
コンパイル時間 37 ms
コンパイル使用メモリ 11,236 KB
実行使用メモリ 16,732 KB
最終ジャッジ日時 2023-10-14 22:46:25
合計ジャッジ時間 6,028 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
15,356 KB
testcase_01 AC 86 ms
15,304 KB
testcase_02 AC 203 ms
16,704 KB
testcase_03 AC 106 ms
15,736 KB
testcase_04 AC 123 ms
15,892 KB
testcase_05 AC 130 ms
15,892 KB
testcase_06 AC 161 ms
16,408 KB
testcase_07 AC 140 ms
16,236 KB
testcase_08 AC 154 ms
16,316 KB
testcase_09 AC 130 ms
15,936 KB
testcase_10 AC 87 ms
15,208 KB
testcase_11 AC 109 ms
15,588 KB
testcase_12 AC 175 ms
16,412 KB
testcase_13 AC 127 ms
16,160 KB
testcase_14 AC 133 ms
16,100 KB
testcase_15 AC 164 ms
16,264 KB
testcase_16 AC 146 ms
16,064 KB
testcase_17 AC 175 ms
16,564 KB
testcase_18 AC 200 ms
16,732 KB
testcase_19 AC 176 ms
16,364 KB
testcase_20 AC 170 ms
16,272 KB
testcase_21 AC 100 ms
15,564 KB
testcase_22 AC 173 ms
16,444 KB
testcase_23 AC 172 ms
16,440 KB
testcase_24 AC 172 ms
16,428 KB
testcase_25 AC 146 ms
16,176 KB
testcase_26 AC 183 ms
16,452 KB
testcase_27 AC 163 ms
16,232 KB
testcase_28 AC 137 ms
16,072 KB
testcase_29 AC 189 ms
16,496 KB
testcase_30 AC 186 ms
16,428 KB
testcase_31 AC 172 ms
16,456 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require"prime"
k=gets.to_i
n=gets.to_i
l=Prime.each(n).select{|i|i>=k}.map{|i|j=i;j=j.to_s.chars.inject(0){|s,c|s+c.to_i} while j>9;[i,j]}
a=[]
cnt=[0]*10
max=0
ans=0
l.each{|i,j|
  a<<[i,j]
  cnt[j]+=1
  cnt[a.shift[1]]-=1 while cnt[j]>1
  if max<=a.size
    max=a.size
    ans=a[0][0]
  end
}
p ans
0