結果

問題 No.632 穴埋め門松列
ユーザー gemmarogemmaro
提出日時 2019-10-19 07:12:23
言語 Ruby
(3.3.0)
結果
AC  
実行時間 82 ms / 1,000 ms
コード長 735 bytes
コンパイル時間 407 ms
コンパイル使用メモリ 11,316 KB
実行使用メモリ 15,252 KB
最終ジャッジ日時 2023-09-08 15:44:15
合計ジャッジ時間 1,956 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,080 KB
testcase_01 AC 80 ms
15,220 KB
testcase_02 AC 79 ms
15,064 KB
testcase_03 AC 79 ms
15,192 KB
testcase_04 AC 79 ms
15,032 KB
testcase_05 AC 82 ms
15,252 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def is_ok_1 c1, c2, c3
    if c1 == 0
        c1 = 1
    elsif c2 == 0
        c2 = 1
    else
        c3 = 1
    end
    if c1 == c2 or c2 == c3 or c3 == c1
        return false
    end
    if [c1, c2, c3].max == c2 or [c1, c2, c3].min == c2
        return true
    else
        return false
    end
end

def is_ok_4 c1, c2, c3
    if c1 == 0
        c1 = 4
    elsif c2 == 0
        c2 = 4
    else
        c3 = 4
    end
    if c1 == c2 or c2 == c3 or c3 == c1
        return false
    end
    if [c1, c2, c3].max == c2 or [c1, c2, c3].min == c2
        return true
    else
        return false
    end
end

c1, c2, c3 = gets.chomp.split.map &:to_i
if is_ok_1(c1, c2, c3)
    print 1
end
if is_ok_4(c1, c2, c3)
    print 4
end
puts
0