結果

問題 No.539 インクリメント
ユーザー NoNo
提出日時 2018-01-21 20:03:23
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,147 bytes
コンパイル時間 3,656 ms
コンパイル使用メモリ 106,704 KB
実行使用メモリ 54,068 KB
最終ジャッジ日時 2023-08-26 20:02:36
合計ジャッジ時間 6,559 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
24,584 KB
testcase_01 WA -
testcase_02 TLE -
testcase_03 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Text.RegularExpressions;

namespace y
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            string[] ans = new string[t];
            for (int i = 0; i < t; i++)
            {
                string s = Console.ReadLine();
                MatchCollection m = Regex.Matches(s, @"[0-9]+");

                string a = "";
                foreach (var v in m)
                {
                    if (v.ToString().Length >= a.Length) a = v.ToString();
                }
                if (a.Length != 0)
                {
                    string y = "";
                    for (int j = 0; j < a.Length; j++)
                    {
                        y += "0";
                    }
                    int h = s.LastIndexOf(a);
                    s = s.Remove(h, a.Length);
                    s = s.Insert(h, (int.Parse(a) + 1).ToString(y));
                }
                ans[i] = s;
            }
            foreach (var item in ans)
            {
                Console.WriteLine(item);
            }
        }
    }
}
0