結果

問題 No.300 平方数
ユーザー LeonardoneLeonardone
提出日時 2015-11-17 05:51:37
言語 Ruby
(3.3.0)
結果
AC  
実行時間 396 ms / 1,000 ms
コード長 263 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 11,268 KB
実行使用メモリ 15,828 KB
最終ジャッジ日時 2023-10-11 17:15:24
合計ジャッジ時間 9,801 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,192 KB
testcase_01 AC 79 ms
15,476 KB
testcase_02 AC 81 ms
15,544 KB
testcase_03 AC 79 ms
15,096 KB
testcase_04 AC 79 ms
15,568 KB
testcase_05 AC 79 ms
15,448 KB
testcase_06 AC 80 ms
15,648 KB
testcase_07 AC 79 ms
15,548 KB
testcase_08 AC 78 ms
15,196 KB
testcase_09 AC 79 ms
15,472 KB
testcase_10 AC 79 ms
15,584 KB
testcase_11 AC 78 ms
15,548 KB
testcase_12 AC 79 ms
15,320 KB
testcase_13 AC 396 ms
15,696 KB
testcase_14 AC 81 ms
15,596 KB
testcase_15 AC 83 ms
15,648 KB
testcase_16 AC 225 ms
15,776 KB
testcase_17 AC 80 ms
15,488 KB
testcase_18 AC 79 ms
15,492 KB
testcase_19 AC 80 ms
15,504 KB
testcase_20 AC 102 ms
15,624 KB
testcase_21 AC 187 ms
15,544 KB
testcase_22 AC 119 ms
15,632 KB
testcase_23 AC 145 ms
15,692 KB
testcase_24 AC 167 ms
15,516 KB
testcase_25 AC 335 ms
15,828 KB
testcase_26 AC 196 ms
15,532 KB
testcase_27 AC 133 ms
15,516 KB
testcase_28 AC 330 ms
15,736 KB
testcase_29 AC 368 ms
15,680 KB
testcase_30 AC 378 ms
15,548 KB
testcase_31 AC 108 ms
15,508 KB
testcase_32 AC 265 ms
15,764 KB
testcase_33 AC 184 ms
15,512 KB
testcase_34 AC 361 ms
15,740 KB
testcase_35 AC 264 ms
15,540 KB
testcase_36 AC 296 ms
15,580 KB
testcase_37 AC 257 ms
15,756 KB
testcase_38 AC 103 ms
15,744 KB
testcase_39 AC 315 ms
15,740 KB
testcase_40 AC 285 ms
15,760 KB
testcase_41 AC 176 ms
15,532 KB
testcase_42 AC 141 ms
15,636 KB
testcase_43 AC 150 ms
15,772 KB
testcase_44 AC 300 ms
15,780 KB
testcase_45 AC 191 ms
15,764 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:7: warning: parentheses after method name is interpreted as an argument list, not a decomposed argument
Syntax OK

ソースコード

diff #

#! ruby
# yukicoder My Practice
# author: Leonardone @ NEETSDKASU

x = gets.to_i

def f (x, k)
    loop { d, m = x.divmod k; break if m != 0; x = d; }; x 
end

x = f(x, 4)

3.step(x ** 0.5, 2) do |k|
    kk = k * k
    break if x < kk
    x = f(x, kk)
end

puts x
0