結果

問題 No.432 占い(Easy)
ユーザー mban
提出日時 2016-10-18 02:29:36
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 773 bytes
コンパイル時間 5,121 ms
コンパイル使用メモリ 111,796 KB
実行使用メモリ 20,992 KB
最終ジャッジ日時 2024-11-22 11:36:09
合計ジャッジ時間 4,909 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


class Program
{
    static void Main()
    {
        int T = int.Parse(Console.ReadLine());
        for(int i = 0; i < T; i++)
        {
            Console.WriteLine(ans(Console.ReadLine()));
        }
    }
    static int ans(string s)
    {
        List<int> A = new List<int>(), B;
        B = s.Select(q => int.Parse(q.ToString())).ToList();
        while (B.Count>1)
        {
            for(int i = 0; i < B.Count - 1; i++)
            {
                int q = B[i] + B[i + 1];
                q = q % 10 + q / 10;
                A.Add(q);
            }
            B = A.ToList();
            A.Clear();
        }
        return B[0];
    }
}

0