結果

問題 No.432 占い(Easy)
ユーザー wowilsonwowilson
提出日時 2016-12-12 15:29:16
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 1,032 bytes
コンパイル時間 2,505 ms
コンパイル使用メモリ 105,992 KB
実行使用メモリ 26,828 KB
最終ジャッジ日時 2023-08-19 20:30:12
合計ジャッジ時間 6,097 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
20,676 KB
testcase_01 AC 51 ms
18,648 KB
testcase_02 AC 48 ms
20,648 KB
testcase_03 AC 48 ms
20,528 KB
testcase_04 AC 50 ms
20,608 KB
testcase_05 AC 48 ms
20,572 KB
testcase_06 AC 51 ms
22,768 KB
testcase_07 AC 49 ms
20,668 KB
testcase_08 AC 48 ms
18,596 KB
testcase_09 AC 49 ms
20,660 KB
testcase_10 AC 52 ms
20,696 KB
testcase_11 AC 57 ms
24,704 KB
testcase_12 AC 161 ms
26,732 KB
testcase_13 AC 160 ms
24,848 KB
testcase_14 AC 59 ms
26,828 KB
testcase_15 AC 52 ms
22,736 KB
testcase_16 AC 49 ms
22,648 KB
testcase_17 AC 148 ms
26,772 KB
testcase_18 AC 97 ms
26,696 KB
testcase_19 AC 77 ms
24,764 KB
testcase_20 AC 61 ms
24,884 KB
testcase_21 AC 65 ms
26,820 KB
testcase_22 AC 49 ms
22,696 KB
testcase_23 AC 49 ms
20,676 KB
testcase_24 AC 52 ms
20,868 KB
testcase_25 AC 52 ms
20,720 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