結果

問題 No.646 逆ピラミッド
ユーザー N/AN/A
提出日時 2018-08-24 21:07:40
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 300 bytes
コンパイル時間 911 ms
コンパイル使用メモリ 27,760 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-05 10:29:09
合計ジャッジ時間 1,667 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 0 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 0 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 0 ms
4,376 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:9:17: 警告: 互換性のないポインタ型から 1 番目の ‘sprintf’ の引数に渡しています [-Wincompatible-pointer-types]
    9 |         sprintf(block, "%d", height);
      |                 ^~~~~
      |                 |
      |                 int *
次のファイルから読み込み:  main.c:2:
/usr/include/stdio.h:334:38: 備考: expected ‘char * restrict’ but argument is of type ‘int *’
  334 | extern int sprintf (char *__restrict __s,
      |                     ~~~~~~~~~~~~~~~~~^~~

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {
	int height, width, block[3];

	scanf("%d", &height);
	width = height;
	sprintf(block, "%d", height);

	for (int i = 0; i < height; i++) {
		for (int j = width; j > i; j--) {
			printf("%s", block);
		}
		puts("");
	}

	return 0;
}
0