結果

問題 No.289 数字を全て足そう
ユーザー ProgramingWeProgramingWe
提出日時 2017-10-27 16:57:16
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 51 ms / 1,000 ms
コード長 755 bytes
コンパイル時間 1,754 ms
コンパイル使用メモリ 102,620 KB
実行使用メモリ 22,864 KB
最終ジャッジ日時 2023-08-14 02:53:24
合計ジャッジ時間 3,930 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
20,668 KB
testcase_01 AC 47 ms
22,824 KB
testcase_02 AC 46 ms
20,604 KB
testcase_03 AC 44 ms
18,656 KB
testcase_04 AC 46 ms
20,724 KB
testcase_05 AC 47 ms
22,776 KB
testcase_06 AC 49 ms
22,784 KB
testcase_07 AC 48 ms
20,664 KB
testcase_08 AC 49 ms
22,776 KB
testcase_09 AC 48 ms
20,660 KB
testcase_10 AC 49 ms
22,784 KB
testcase_11 AC 50 ms
20,624 KB
testcase_12 AC 49 ms
22,864 KB
testcase_13 AC 50 ms
20,684 KB
testcase_14 AC 51 ms
20,696 KB
testcase_15 AC 49 ms
20,672 KB
testcase_16 AC 51 ms
20,740 KB
testcase_17 AC 51 ms
20,604 KB
testcase_18 AC 49 ms
20,740 KB
testcase_19 AC 47 ms
20,636 KB
testcase_20 AC 49 ms
20,636 KB
testcase_21 AC 48 ms
20,708 KB
testcase_22 AC 50 ms
20,652 KB
testcase_23 AC 49 ms
22,784 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] cs = Console.ReadLine().ToCharArray();
            List<int> listn = new List<int>();
            int s;
            int a = 0;
            int count = 0;
            for (int i = 0; i < cs.Length; i++)
            {
                if (int.TryParse(cs[i].ToString(), out s))
                {
                    listn.Add(int.Parse(cs[i].ToString()));
                }
            }
            for (int i = 0; i < listn.Count; i++)
            {
                count = count + listn[i];
            }
            Console.WriteLine(count);
        }
    }
}
0