結果
| 問題 |
No.455 冬の大三角
|
| コンテスト | |
| ユーザー |
hirakich1048576
|
| 提出日時 | 2016-12-07 22:10:32 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 672 bytes |
| コンパイル時間 | 233 ms |
| コンパイル使用メモリ | 20,992 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-28 03:30:18 |
| 合計ジャッジ時間 | 2,163 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 44 WA * 10 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:35:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
35 | scanf("%d%d", &h, &w);
| ^~~~~~~~~~~~~~~~~~~~~
main.c:37:33: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
37 | for (i = 0; i < h; i++) scanf("%s", s[i]);
| ^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
typedef struct {int h; int w;} vect;
int i, j, h, w;
char s[100][101];
vect x, y;
void findstars()
{
x.h = -1;
for (i = 0; i < h; i++)
for (j = 0; j < w; j++)
{
if (s[i][j]) {
if (x.h == -1) {
x.h = i;
x.w = j;
} else {
y.h = i;
y.w = j;
return;
}
}
}
}
void l () {
for (i = 0; i < h; i++) puts(s[i]);
return;
}
int main(int argc, char const *argv[])
{
scanf("%d%d", &h, &w);
for (i = 0; i < h; i++) scanf("%s", s[i]);
findstars();
if (x.h == y.h) {
if (x.h) {
s[x.h - 1][y.h] = '*';
} else {
s[x.h + 1][y.h] = '*';
}
} else {
s[x.h][y.w] = '*';
}
l();
return 0;
}
hirakich1048576