結果

問題 No.434 占い
ユーザー rtomprtomp
提出日時 2016-11-11 18:32:33
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 2,315 bytes
コンパイル時間 1,597 ms
コンパイル使用メモリ 108,032 KB
実行使用メモリ 48,952 KB
最終ジャッジ日時 2024-05-04 02:13:45
合計ジャッジ時間 4,810 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
24,064 KB
testcase_01 AC 26 ms
18,816 KB
testcase_02 AC 27 ms
18,688 KB
testcase_03 AC 27 ms
18,944 KB
testcase_04 AC 31 ms
19,584 KB
testcase_05 AC 28 ms
18,944 KB
testcase_06 AC 31 ms
19,456 KB
testcase_07 AC 28 ms
19,200 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.IO;
using System.Linq;

public class YukiCoder
{
    public static void Solve()
    {
        var T = MyConsole.Int();
        
        while (T-- > 0)
        {
            string ANS =  MyConsole.String();

            while (ANS.Length > 1)
            {
                var len = ANS.Length;

                string math = "";

                for (int pos = 0 ; pos < len - 1 ; pos++)
                {
                    int tmp = int.Parse( ANS[pos].ToString() ) + int.Parse( ANS[pos + 1].ToString() );

                    if (tmp >= 10)
                    {
                        math += tmp / 10 + ( tmp - 10 );
                    }
                    else
                    {
                        math += tmp;
                    }
                }

                ANS = math;
            }

            MyConsole.wLine( ANS.ToString() );
        }
    }

    public static void Main()
    {
        MyConsole.Read(); Solve(); MyConsole.Finish();
    }
}

public static class MyConsole
{
    private static List<string> ReadedLine = new List<string>();
    private static char[] buf = new char[1024];
    private static int i;

    public static void Read()
    {
        string sr = Console.In.ReadToEnd();

        ReadedLine = sr.Split( new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries ).ToList();

        Console.SetOut( new StreamWriter( Console.OpenStandardOutput() ) { AutoFlush = false } );
    }

    public static string String() { return ReadedLine[i++]; }
    public static string[] StringSplit() { return ReadedLine[i++].Split( new[] { ' ' } ); }

    public static int Int() { return int.Parse( ReadedLine[i++] ); }
    public static int[] IntSplit()
    {
        string[] strs = StringSplit();
        int[] ret = new int[strs.Length];
        for (int i = 0 ; i < strs.Length ; i++)
        {
            ret[i] = int.Parse( strs[i] );
        }

        return ret;
    }
    public static long Long() { return long.Parse( ReadedLine[i++] ); }
    public static double Double() { return double.Parse( ReadedLine[i++] ); }

    public static void wLine( string output = null )
    {
        Console.WriteLine( output );
    }

    public static void Finish()
    {
        Console.Out.Flush();
    }
}
0