結果

問題 No.680 作れる数
ユーザー smz_8110smz_8110
提出日時 2018-08-22 15:40:30
言語 Ruby
(3.3.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 205 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 11,484 KB
実行使用メモリ 15,364 KB
最終ジャッジ日時 2023-08-25 18:20:19
合計ジャッジ時間 2,957 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,272 KB
testcase_01 AC 77 ms
15,088 KB
testcase_02 AC 77 ms
15,084 KB
testcase_03 AC 77 ms
15,236 KB
testcase_04 AC 79 ms
15,212 KB
testcase_05 AC 74 ms
15,092 KB
testcase_06 AC 77 ms
15,364 KB
testcase_07 AC 70 ms
15,276 KB
testcase_08 AC 71 ms
15,216 KB
testcase_09 AC 74 ms
15,132 KB
testcase_10 AC 74 ms
15,312 KB
testcase_11 AC 71 ms
15,348 KB
testcase_12 AC 70 ms
15,160 KB
testcase_13 AC 72 ms
15,084 KB
testcase_14 AC 74 ms
15,088 KB
testcase_15 AC 71 ms
15,308 KB
testcase_16 AC 68 ms
15,276 KB
testcase_17 AC 71 ms
15,164 KB
testcase_18 AC 69 ms
15,088 KB
testcase_19 AC 68 ms
15,100 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

F=->n{
  c=n
  c+=n/=2 while n>0
  c
}
S=->n,i,j{
  k=(j+i)/2
  r=F[k]
  if r==n
    true
  elsif i==j-1
    false
  elsif r>n
    S[n,i,k]
  else
    S[n,k,j]
  end
}
puts S[N=gets.to_i,1,N] ? :YES : :NO
0