結果

問題 No.3006 A winter wonderland
ユーザー gigurururugigurururu
提出日時 2014-12-26 16:51:33
言語 Ruby
(3.3.0)
結果
AC  
実行時間 288 ms / 5,000 ms
コード長 420 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 11,488 KB
実行使用メモリ 33,504 KB
最終ジャッジ日時 2023-09-03 18:34:11
合計ジャッジ時間 5,513 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,192 KB
testcase_01 AC 117 ms
19,652 KB
testcase_02 AC 101 ms
17,816 KB
testcase_03 AC 288 ms
33,504 KB
testcase_04 AC 109 ms
19,076 KB
testcase_05 AC 92 ms
16,412 KB
testcase_06 AC 91 ms
16,168 KB
testcase_07 AC 84 ms
15,020 KB
testcase_08 AC 96 ms
16,428 KB
testcase_09 AC 91 ms
16,176 KB
testcase_10 AC 99 ms
17,588 KB
testcase_11 AC 128 ms
21,824 KB
testcase_12 AC 82 ms
15,148 KB
testcase_13 AC 86 ms
15,148 KB
testcase_14 AC 90 ms
16,072 KB
testcase_15 AC 85 ms
15,028 KB
testcase_16 AC 90 ms
16,060 KB
testcase_17 AC 90 ms
16,080 KB
testcase_18 AC 89 ms
15,632 KB
testcase_19 AC 96 ms
16,876 KB
testcase_20 AC 92 ms
17,076 KB
testcase_21 AC 87 ms
15,772 KB
testcase_22 AC 97 ms
17,628 KB
testcase_23 AC 98 ms
17,660 KB
testcase_24 AC 82 ms
15,096 KB
testcase_25 AC 86 ms
15,284 KB
testcase_26 AC 93 ms
16,756 KB
testcase_27 AC 85 ms
15,152 KB
testcase_28 AC 113 ms
19,712 KB
testcase_29 AC 84 ms
15,024 KB
testcase_30 AC 84 ms
15,088 KB
testcase_31 AC 109 ms
18,988 KB
testcase_32 AC 84 ms
15,108 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def sqrt_enum(n)
  return to_enum(:sqrt_enum,n) unless block_given?
  list=[]
  while n>0
    list << n%100
    n/=100
  end
  list.reverse
  carry=0
  subcarry=0
  while list[0]||carry!=0
    n=(list.shift||0)+carry*100
    a=(1..10).find{|i|(subcarry*10+i)*i>n}-1
    yield a
    carry=n-(subcarry*10+a)*a
    subcarry=subcarry*10+a*2
  end
end

x=gets.chomp.chars.map(&:to_i)
p sqrt_enum(2).each_cons(3).find_index(x)
0