結果

問題 No.112 ややこしい鶴亀算
ユーザー akko_yukky
提出日時 2017-05-25 17:17:03
言語 Ruby
(3.4.1)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 389 bytes
コンパイル時間 121 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-09-19 19:14:04
合計ジャッジ時間 2,800 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n=gets.to_i
animals = gets.split.map(&:to_i)

if animals.max == animals.min then

        if animals[0]/(n-1)==2 then
                tsuru=n
                kame=0
        end

        if animals[0]/(n-1)==4 then
                tsuru=0
                kame=n
        end

else
        tsuru=animals.count(animals.max)
        kame=animals.count(animals.min)
end

puts "#{tsuru}\s#{kame}"
0