結果

問題 No.9009 改行区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー korogykorogy
提出日時 2017-09-02 16:39:32
言語 Ruby
(3.3.0)
結果
AC  
実行時間 399 ms / 3,000 ms
コード長 531 bytes
コンパイル時間 458 ms
コンパイル使用メモリ 11,500 KB
実行使用メモリ 19,380 KB
最終ジャッジ日時 2023-08-26 17:53:33
合計ジャッジ時間 5,121 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
15,136 KB
testcase_01 AC 71 ms
15,292 KB
testcase_02 AC 72 ms
15,160 KB
testcase_03 AC 69 ms
14,992 KB
testcase_04 AC 69 ms
15,132 KB
testcase_05 AC 71 ms
14,992 KB
testcase_06 AC 71 ms
15,292 KB
testcase_07 AC 77 ms
15,412 KB
testcase_08 AC 103 ms
15,660 KB
testcase_09 AC 144 ms
16,192 KB
testcase_10 AC 327 ms
18,532 KB
testcase_11 AC 332 ms
18,652 KB
testcase_12 AC 347 ms
18,500 KB
testcase_13 AC 364 ms
18,788 KB
testcase_14 AC 369 ms
19,036 KB
testcase_15 AC 381 ms
18,916 KB
testcase_16 AC 399 ms
19,380 KB
testcase_17 AC 74 ms
15,196 KB
testcase_18 AC 73 ms
14,992 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class FindTotalValue2
    attr_reader :n, :a
    
        def initialize(n: 0, a: [])
            @n, @a = n, a
        end
    
        def datainput
            begin
                @n = Integer(gets.chomp)
                @a = @n.times.map { Integer(gets.chomp) }
            rescue
                
            end
        end

        def dataoutput
            puts @a.inject(:+)
        end
    
        def run
            datainput
            dataoutput
        end
end

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