結果

問題 No.455 冬の大三角
ユーザー くれちー
提出日時 2016-12-03 02:25:21
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 769 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 22,656 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-27 20:37:03
合計ジャッジ時間 1,908 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 49 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |     scanf("%d %d", &h, &w);
      |     ^~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>

int getrand(int min, int max) {
	return min + (int)(rand() * (max - min + 1.0) / (1.0 + RAND_MAX));
}

int main() {
    int h, w;
    scanf("%d %d", &h, &w);
    getchar();

    char s[100][100];
    int i, j;
    for (i = 0; i < h; i++) {
        for (j = 0; j < w; j++) {
            s[i][j] = getchar();
        }
        getchar();
    }

    int sw, sh;
    do {
        sw = getrand(0, w - 1);
        sh = getrand(0, h - 1);
    }
    while (s[sh][sw] == '*');

    for (i = 0; i < h; i++) {
        for (j = 0; j < w; j++) {
            if (i == sh && j == sw) {
                printf("*");
                continue;
            }
            printf("%c", s[i][j]);
        }
        printf("\n");
    }

    return 0;
}
0