結果

問題 No.432 占い(Easy)
ユーザー mencotton
提出日時 2018-03-19 20:44:57
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 896 bytes
コンパイル時間 3,178 ms
コンパイル使用メモリ 102,784 KB
実行使用メモリ 21,504 KB
最終ジャッジ日時 2024-06-11 15:21:17
合計ジャッジ時間 4,682 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

namespace _432
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            for (int i = 0; i < n; i++)
            {
                string s = Console.ReadLine();
                List<int> list = new List<int>();
                for (int j = 0; j < s.Length; j++) list.Add(int.Parse(s[j].ToString()));
                while (list.Count > 1)
                {
                    List<int> result = new List<int>();
                    for (int j = 0; j < list.Count - 1; j++)
                    {
                        int a = list[j] + list[j + 1];
                        result.Add(a >= 10 ? 1 + (a % 10) : a);
                    }
                    list = result;
                }
                Console.WriteLine(list[0]);
            }
        }
    }
}
0