結果

問題 No.747 循環小数N桁目 Hard
ユーザー manhattaner
提出日時 2018-11-02 13:02:56
言語 Ruby
(3.4.1)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 353 bytes
コンパイル時間 1,106 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-11-20 13:03:23
合計ジャッジ時間 17,212 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 120
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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