結果

問題 No.432 占い(Easy)
ユーザー wowilsonwowilson
提出日時 2016-12-12 15:29:16
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 1,032 bytes
コンパイル時間 2,029 ms
コンパイル使用メモリ 111,872 KB
実行使用メモリ 31,748 KB
最終ジャッジ日時 2024-05-07 03:31:55
合計ジャッジ時間 3,986 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
27,624 KB
testcase_01 AC 23 ms
23,768 KB
testcase_02 AC 24 ms
25,980 KB
testcase_03 AC 23 ms
25,548 KB
testcase_04 AC 25 ms
25,716 KB
testcase_05 AC 23 ms
23,644 KB
testcase_06 AC 22 ms
23,764 KB
testcase_07 AC 24 ms
25,840 KB
testcase_08 AC 22 ms
23,664 KB
testcase_09 AC 25 ms
23,792 KB
testcase_10 AC 24 ms
25,680 KB
testcase_11 AC 32 ms
25,744 KB
testcase_12 AC 150 ms
29,836 KB
testcase_13 AC 150 ms
31,748 KB
testcase_14 AC 34 ms
29,708 KB
testcase_15 AC 22 ms
23,780 KB
testcase_16 AC 23 ms
25,812 KB
testcase_17 AC 131 ms
27,516 KB
testcase_18 AC 76 ms
27,776 KB
testcase_19 AC 56 ms
29,960 KB
testcase_20 AC 38 ms
29,836 KB
testcase_21 AC 39 ms
28,040 KB
testcase_22 AC 24 ms
25,840 KB
testcase_23 AC 22 ms
23,764 KB
testcase_24 AC 24 ms
23,512 KB
testcase_25 AC 25 ms
25,704 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace Yukicoder
{
    public class Program
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            for (int i = 0; i < n; i++)
            {
                string num = Console.ReadLine();
                Solve(num);
            }
        }

        private static void Solve(string num)
        {
            string tmp = num;
            string ans = "";
            int len = tmp.Length;
            while (len > 1)
            {
                for (int i = 1; i < len; i++)
                {
                    int x = GetInt(tmp[i], tmp[i - 1]);
                    string str = x.ToString();
                    ans += x > 9 ? GetInt(str[0],str[1]).ToString() : str;
                }
                tmp = ans;
                ans = "";
                len--;
            }
            Console.WriteLine(tmp);
        }

        private static int GetInt(char v1, char v2)
        {
            return (v1 - '0') + (v2 - '0');
        }
    }
}

0