結果
問題 | No.539 インクリメント |
ユーザー |
![]() |
提出日時 | 2017-07-11 18:57:01 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,578 bytes |
コンパイル時間 | 1,050 ms |
コンパイル使用メモリ | 111,648 KB |
実行使用メモリ | 48,872 KB |
最終ジャッジ日時 | 2024-10-07 15:04:14 |
合計ジャッジ時間 | 2,223 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 3 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;using System.Collections;using System.Collections.Generic;using System.Collections.Specialized;using System.Text;using System.Text.RegularExpressions;using System.Linq;using System.IO;class Program{static void Main(){new Magatro().Solve();}}class Magatro{private int T;private string Func(string s){var c = s.ToList();for (int i = c.Count - 1; i >= 0; i--){if ('0' <= c[i] && c[i] <= '9'){int j;bool p = true;for (j = i; j >= 0 && p; j--){if (!('0' <= c[j] && c[j] <= '9')){break;}if (c[j] == '9'){c[j] = '0';}else{c[j]++;p = false;break;}}if (p){c.Insert(j + 1, '1');}break;}}return new string(c.ToArray());}private void Scan(){T = int.Parse(Console.ReadLine());}public void Solve(){Scan();var sb = new StringBuilder();for (int i = 0; i < T; i++){sb.AppendLine(Func(Console.ReadLine()));}Console.WriteLine(sb.ToString());}}