結果

問題 No.63 ポッキーゲーム
ユーザー korogy
提出日時 2017-09-07 02:18:05
言語 Ruby
(3.4.1)
結果
AC  
実行時間 100 ms / 5,000 ms
コード長 593 bytes
コンパイル時間 47 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-12-24 05:40:09
合計ジャッジ時間 3,075 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class PockyGame
    attr_reader :l, :k

    def initialize(l: 0, k: 0)
        @l, @k = l, k
    end

    def datainput
        begin
            @l, @k = gets.chomp.split.map { |v| Integer(v) }
        rescue
            
        end
    end

    def pockygame(pocky_length, once_length)
        cnt = pocky_length / (once_length * 2)
        cnt -= 1 if pocky_length % (once_length * 2) == 0
        once_length * cnt
    end

    def dataoutput
        puts pockygame(@l, @k)
    end

    def run
        datainput
        dataoutput
    end
end

if $0 == __FILE__
    PockyGame.new.run
end
0