結果

問題 No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー korogykorogy
提出日時 2017-09-02 16:15:30
言語 Ruby
(3.3.0)
結果
AC  
実行時間 247 ms / 2,000 ms
コード長 448 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 44,672 KB
最終ジャッジ日時 2024-04-24 10:53:41
合計ジャッジ時間 3,928 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
12,288 KB
testcase_01 AC 74 ms
12,288 KB
testcase_02 AC 77 ms
12,416 KB
testcase_03 AC 76 ms
12,160 KB
testcase_04 AC 75 ms
12,160 KB
testcase_05 AC 77 ms
12,160 KB
testcase_06 AC 80 ms
12,288 KB
testcase_07 AC 83 ms
12,800 KB
testcase_08 AC 101 ms
16,512 KB
testcase_09 AC 123 ms
19,456 KB
testcase_10 AC 218 ms
38,400 KB
testcase_11 AC 231 ms
38,912 KB
testcase_12 AC 221 ms
39,552 KB
testcase_13 AC 228 ms
40,192 KB
testcase_14 AC 227 ms
40,448 KB
testcase_15 AC 233 ms
41,216 KB
testcase_16 AC 247 ms
44,672 KB
testcase_17 AC 79 ms
12,032 KB
testcase_18 AC 79 ms
12,288 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class FindTotalValue
    attr_reader :n, :a

    def initialize(n: 0, a: [])
        @n, @a = n, a
    end

    def datainput
        begin
            @n = Integer(gets.chomp)
            @a = gets.chomp.split.map { |v| Integer(v) }
        rescue
            
        end
    end

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

    def run
        datainput
        dataoutput
    end
end

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