結果

問題 No.933 おまわりさんこいつです
ユーザー mame_shibe
提出日時 2019-12-04 23:09:28
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 973 bytes
コンパイル時間 874 ms
コンパイル使用メモリ 112,540 KB
実行使用メモリ 45,980 KB
最終ジャッジ日時 2024-12-14 14:13:33
合計ジャッジ時間 3,005 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 12 RE * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.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