結果
| 問題 | No.646 逆ピラミッド |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-24 21:07:40 |
| 言語 | C11(gcc12 gnu拡張) (gcc 12.4.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 300 bytes |
| 記録 | |
| コンパイル時間 | 109 ms |
| コンパイル使用メモリ | 31,556 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-08 16:17:58 |
| 合計ジャッジ時間 | 524 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:17: warning: passing argument 1 of ‘sprintf’ from incompatible pointer type [-Wincompatible-pointer-types]
9 | sprintf(block, "%d", height);
| ^~~~~
| |
| int *
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
from /usr/include/stdio.h:28,
from main.c:2:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:28:1: note: expected ‘char * restrict’ but argument is of type ‘int *’
28 | __NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...))
| ^~~~~
main.c:13:34: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int *’ [-Wformat=]
13 | printf("%s", block);
| ~^ ~~~~~
| | |
| | int *
| char *
| %ls
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d", &height);
| ^~~~~~~~~~~~~~~~~~~~
ソースコード
#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;
}