結果

問題 No.1942 Leading zero
ユーザー elphe
提出日時 2025-04-06 13:46:33
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 595 ms
コンパイル使用メモリ 58,656 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-06 13:46:35
合計ジャッジ時間 1,362 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |         scanf("%u", &N);
      |         ~~~~~^~~~~~~~~~
main.cpp:23:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |                 scanf("%s", S[i]);
      |                 ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cstdint>
#include <algorithm>

using namespace std;

static inline void output(const uint32_t N, const char (*S)[6])
{
	for (uint32_t i = 0; i != N; ++i)
	{
		uint32_t j;
		for (j = 0; S[i][j] == '0'; ++j);
		printf("%s\n", S[i] + min<uint32_t>(j, 4));
	}
}

int main()
{	
	uint32_t N, i;
	scanf("%u", &N);
	char (*S)[6] = new char[N][6];
	for (i = 0; i != N; ++i)
		scanf("%s", S[i]);

	output(N, S);
	delete[] S;
	return 0;
}
0