結果
| 問題 |
No.539 インクリメント
|
| コンテスト | |
| ユーザー |
No
|
| 提出日時 | 2017-07-30 16:56:39 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,299 bytes |
| コンパイル時間 | 854 ms |
| コンパイル使用メモリ | 104,192 KB |
| 実行使用メモリ | 32,896 KB |
| 最終ジャッジ日時 | 2024-10-10 22:34:22 |
| 合計ジャッジ時間 | 1,692 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.Linq;
namespace y
{
class Program
{
static void Main(string[] args)
{
int t = int.Parse(Console.ReadLine());
for (int i = 0; i < t; i++)
{
string s = Console.ReadLine();
int nn = s.Length - 1;
for (int j = s.Length - 1; j >= 0; j--)
{
if ('0' <= s[j] && s[j] <= '9')
{
}
else
{
nn = j + 1;
break;
}
}
string ns = "";
bool f = false;
if (nn != s.Length)
{
int newNum = int.Parse(s.Substring(nn)) + 1;
if (newNum.ToString().Length != s.Substring(nn).Length)
{
f = true;
}
ns = newNum.ToString();
}
int aaa = ns.Length;
if (f)
{
aaa--;
}
string ans = s.Substring(0, s.Length - aaa) + ns;
Console.WriteLine(ans);
}
}
}
}
No