結果

問題 No.933 おまわりさんこいつです
ユーザー tomomo2b2tomomo2b2
提出日時 2019-11-29 21:54:31
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 898 bytes
コンパイル時間 962 ms
コンパイル使用メモリ 110,736 KB
実行使用メモリ 45,740 KB
最終ジャッジ日時 2024-04-30 23:25:59
合計ジャッジ時間 4,037 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
25,568 KB
testcase_01 AC 31 ms
25,196 KB
testcase_02 AC 32 ms
27,368 KB
testcase_03 AC 32 ms
27,372 KB
testcase_04 AC 31 ms
25,320 KB
testcase_05 AC 31 ms
25,312 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 184 ms
37,972 KB
testcase_18 AC 30 ms
25,196 KB
testcase_19 AC 225 ms
39,612 KB
testcase_20 WA -
testcase_21 AC 31 ms
25,320 KB
testcase_22 AC 31 ms
25,192 KB
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;
using System.Collections.Generic;
using System.IO;

class MyClass
{
    public static long DigitSum(long n)
    {
        if (n < 10)
        {
            return n;
        }
        else
        {
            return DigitSum(n.ToString().ToCharArray().Select(y => long.Parse(y.ToString())).Sum());
        }
    }

    public static void Solve()
    {
        var N = int.Parse(Console.ReadLine());
        var P = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var Q = P.Select(DigitSum);
        var prod = 1L;
        foreach (var item in Q)
        {
            prod *= item;
        }
        Console.WriteLine(DigitSum(prod));
    }

    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
}
0