結果

問題 No.1942 Leading zero
ユーザー marimom7marimom7
提出日時 2022-06-30 02:24:40
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 894 bytes
コンパイル時間 11,523 ms
コンパイル使用メモリ 170,856 KB
実行使用メモリ 215,400 KB
最終ジャッジ日時 2024-05-02 22:45:11
合計ジャッジ時間 8,544 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (91 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;
public class Program
{
    static void Main()
    {
			// データ初期化
			string outputString = "";

			// 初期データ入力
			string line = System.Console.ReadLine();

			// 処理開始
			string readString = "";
			bool checkZero = false;
			for(int i = 0; i < int.Parse(line); i++)
			{
				readString = System.Console.ReadLine();

				checkZero = true;
				for(int stcount = 0; stcount < readString.Length; stcount++)
				{
					// ゼロが終わるまで空回し
					if(checkZero) checkZero = readString[stcount] == '0';
					if(checkZero) continue;

					// 空回しが終わったらデータ作成
					outputString += readString[stcount];
				}

				// 全てが0なら一文字追加する
				if(checkZero) outputString += "0";

				outputString += "\n";
			}

			outputString.Remove(outputString.Length - 1);
			Console.WriteLine(outputString);
    }
}
0