結果

問題 No.552 十分簡単な星1の問題
ユーザー happy-beans
提出日時 2017-09-03 11:30:51
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 263 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 22,528 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-06 19:58:39
合計ジャッジ時間 8,040 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 47
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%s", s);
      |         ~~~~~^~~~~~~~~
main.cpp:6:14: warning: ‘s’ is used uninitialized [-Wuninitialized]
    6 |         scanf("%s", s);
      |         ~~~~~^~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[]) {
	char *s;
	scanf("%s", s);

	if (!strcmp(s, "0")) {
		printf("%d\n", 0);
	}
	else {
		for (int i = 0; s[i] != '\0'; i++) {
			printf("%c", s[i]);
		}
		printf("%d\n", 0);
	}

	return 0;
}
0