結果

問題 No.933 おまわりさんこいつです
ユーザー mame_shibemame_shibe
提出日時 2019-12-04 23:09:28
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 973 bytes
コンパイル時間 1,128 ms
コンパイル使用メモリ 67,908 KB
実行使用メモリ 40,336 KB
最終ジャッジ日時 2023-08-21 05:20:42
合計ジャッジ時間 4,561 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
21,728 KB
testcase_01 AC 59 ms
21,788 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 59 ms
21,732 KB
testcase_05 RE -
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 91 ms
27,044 KB
testcase_18 AC 59 ms
21,636 KB
testcase_19 AC 98 ms
29,808 KB
testcase_20 WA -
testcase_21 AC 60 ms
23,596 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace YukiCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve();
        }

        public void Solve()
        {
            int n = int.Parse(ReadLine());
            int[] p = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

            int k = 1;
            for (int i = 0; i < n; i++)
            {
                k *= p[i];
            }
            
            while (k.ToString().Length != 1)
            {
                int sum = 0;
                for (int i = 0; i < k.ToString().Length; i++)
                {
                    sum += int.Parse(k.ToString()[i].ToString());
                }

                k = sum;
            }
            
            WriteLine(k);
        }
    }
}

0