結果

問題 No.289 数字を全て足そう
ユーザー CroweaCrowea
提出日時 2019-01-24 19:10:53
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 61 ms / 1,000 ms
コード長 527 bytes
コンパイル時間 910 ms
コンパイル使用メモリ 65,344 KB
実行使用メモリ 23,440 KB
最終ジャッジ日時 2023-10-14 09:42:20
合計ジャッジ時間 3,624 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
23,396 KB
testcase_01 AC 57 ms
23,388 KB
testcase_02 AC 57 ms
21,244 KB
testcase_03 AC 55 ms
19,408 KB
testcase_04 AC 56 ms
21,388 KB
testcase_05 AC 58 ms
23,392 KB
testcase_06 AC 58 ms
21,616 KB
testcase_07 AC 59 ms
21,488 KB
testcase_08 AC 58 ms
21,228 KB
testcase_09 AC 57 ms
21,364 KB
testcase_10 AC 58 ms
21,320 KB
testcase_11 AC 59 ms
23,440 KB
testcase_12 AC 59 ms
21,524 KB
testcase_13 AC 58 ms
21,316 KB
testcase_14 AC 59 ms
21,424 KB
testcase_15 AC 60 ms
23,436 KB
testcase_16 AC 58 ms
21,552 KB
testcase_17 AC 58 ms
21,404 KB
testcase_18 AC 60 ms
23,320 KB
testcase_19 AC 58 ms
23,368 KB
testcase_20 AC 58 ms
21,512 KB
testcase_21 AC 56 ms
23,280 KB
testcase_22 AC 59 ms
23,416 KB
testcase_23 AC 61 ms
21,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var list = Console.ReadLine();
        var nums = new List<int>();
        int numeric = 0;

        for (int i = 0; i < list.Length; i++)
        {
            var s = list[i];

            if (int.TryParse(s.ToString(), out numeric))
            {
                nums.Add(int.Parse(s.ToString()));
            }
        }
        Console.WriteLine(nums.Count > 0 ? nums.Sum() : 0);
    }
}
0