結果

問題 No.747 循環小数N桁目 Hard
コンテスト
ユーザー manhattaner
提出日時 2018-11-02 13:02:56
言語 Ruby
(4.0.6 + ACL)
コンパイル:
ruby -w -c _filename_
実行:
ruby _filename_
結果
AC  
実行時間 70 ms / 2,000 ms
+ 201µs
コード長 353 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 519 ms
コンパイル使用メモリ 8,704 KB
実行使用メモリ 15,264 KB
最終ジャッジ日時 2026-09-27 01:01:24
合計ジャッジ時間 14,116 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 120
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #
raw source code

N = gets.to_i
K = gets.to_i

Quotient = "285714"

case n = N % Quotient.size
when 1, 3, 4 then
    puts Quotient[n - 1]
when 2 then
    if K.odd? then
        puts Quotient[1]
    else
        puts Quotient[3]
    end
when 5 then
    if K.odd? then
        puts Quotient[4]
    else
        puts Quotient[0]
    end
when 0 then
    puts Quotient[5]
end
0