結果

問題 No.933 おまわりさんこいつです
ユーザー TSF_initialDTSF_initialD
提出日時 2020-03-30 12:10:30
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,295 ms / 2,000 ms
コード長 307 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 11,400 KB
実行使用メモリ 148,760 KB
最終ジャッジ日時 2023-09-02 12:05:12
合計ジャッジ時間 7,415 ms
ジャッジサーバーID
(参考情報)
judge16 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
15,132 KB
testcase_01 AC 87 ms
15,112 KB
testcase_02 AC 86 ms
15,252 KB
testcase_03 AC 84 ms
15,060 KB
testcase_04 AC 89 ms
15,064 KB
testcase_05 AC 87 ms
15,140 KB
testcase_06 AC 88 ms
15,200 KB
testcase_07 AC 85 ms
15,152 KB
testcase_08 AC 87 ms
15,240 KB
testcase_09 AC 85 ms
15,008 KB
testcase_10 AC 88 ms
15,136 KB
testcase_11 AC 86 ms
15,240 KB
testcase_12 AC 88 ms
15,276 KB
testcase_13 AC 90 ms
16,252 KB
testcase_14 AC 95 ms
17,260 KB
testcase_15 AC 105 ms
23,452 KB
testcase_16 AC 215 ms
60,540 KB
testcase_17 AC 118 ms
22,812 KB
testcase_18 AC 87 ms
15,292 KB
testcase_19 AC 169 ms
49,172 KB
testcase_20 AC 643 ms
129,616 KB
testcase_21 AC 90 ms
15,244 KB
testcase_22 AC 85 ms
15,144 KB
testcase_23 AC 858 ms
128,304 KB
testcase_24 AC 1,295 ms
148,760 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n = $stdin.gets.to_i
arr =gets.chomp.split(" ").map(&:to_i);
ans = 1

arr.each do |k|
    if k == 0
        puts 0
        exit
    else
        if k % 9 == 0
            m = 9
        else
            m = k % 9
        end
        ans *= m
    end
end


if ans % 9 == 0
    puts 9
else
    puts ans % 9
end
0