結果

問題 No.1942 Leading zero
ユーザー marimom7marimom7
提出日時 2022-06-30 02:19:39
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 951 bytes
コンパイル時間 14,720 ms
コンパイル使用メモリ 167,140 KB
実行使用メモリ 212,756 KB
最終ジャッジ日時 2024-05-02 22:39:34
合計ジャッジ時間 10,513 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (98 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;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

	class Program
	{
		static void Main(string[] args)
		{
			// データ初期化
			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";
			}

			Console.WriteLine(outputString);
		}
	}
0