結果
問題 | No.8006 A winter wonderland |
ユーザー |
|
提出日時 | 2014-12-26 16:51:33 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 265 ms / 5,000 ms |
コード長 | 420 bytes |
コンパイル時間 | 285 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 25,472 KB |
最終ジャッジ日時 | 2024-06-12 23:46:20 |
合計ジャッジ時間 | 4,474 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
コンパイルメッセージ
Syntax OK
ソースコード
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)