結果

問題 No.432 占い(Easy)
ユーザー bluemeganebluemegane
提出日時 2018-09-16 13:56:26
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 952 bytes
コンパイル時間 2,457 ms
コンパイル使用メモリ 104,216 KB
実行使用メモリ 23,632 KB
最終ジャッジ日時 2023-09-25 08:59:16
合計ジャッジ時間 5,334 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
23,540 KB
testcase_01 AC 63 ms
21,548 KB
testcase_02 AC 63 ms
23,568 KB
testcase_03 AC 64 ms
21,428 KB
testcase_04 AC 63 ms
21,384 KB
testcase_05 AC 67 ms
23,468 KB
testcase_06 AC 63 ms
21,544 KB
testcase_07 AC 64 ms
23,568 KB
testcase_08 AC 64 ms
21,476 KB
testcase_09 AC 64 ms
23,524 KB
testcase_10 AC 64 ms
21,512 KB
testcase_11 AC 66 ms
21,540 KB
testcase_12 AC 77 ms
21,616 KB
testcase_13 AC 78 ms
21,588 KB
testcase_14 AC 65 ms
21,508 KB
testcase_15 AC 63 ms
21,476 KB
testcase_16 AC 69 ms
21,548 KB
testcase_17 AC 77 ms
23,480 KB
testcase_18 AC 71 ms
23,532 KB
testcase_19 AC 68 ms
21,440 KB
testcase_20 AC 65 ms
21,568 KB
testcase_21 AC 66 ms
21,444 KB
testcase_22 AC 65 ms
23,632 KB
testcase_23 AC 64 ms
21,524 KB
testcase_24 AC 64 ms
21,592 KB
testcase_25 AC 63 ms
23,472 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Text;
using System.Collections.Generic;
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        var sb = new StringBuilder();
        var n = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < n; i++)
            sb.Append(getAns(Console.ReadLine().Trim()));
        Console.Write(sb);
    }
    public static string getAns(string s)
    {
        var sL = s.Length;
        var a = new List<int>();
        var b = new List<int>();
        for (int i = 0; i < sL; i++) a.Add(int.Parse(s[i].ToString()));
        while (a.Count() > 1)
        {
            b.Clear();
            for (int j = 0; j < a.Count() - 1; j++)
            {
                var w = a[j] + a[j + 1];
                if (w >= 10) w -= 9;
                b.Add(w);
            }
            a.Clear();
            foreach (var x in b) a.Add(x);
        }
        return string.Format("{0}\n", a[0]);
    }
}
0