結果

問題 No.455 冬の大三角
ユーザー olphe
提出日時 2016-12-06 13:32:31
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 755 bytes
コンパイル時間 556 ms
コンパイル使用メモリ 64,764 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-28 01:58:31
合計ジャッジ時間 2,386 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "iostream"
#include "iomanip"
#include "math.h"
using namespace std;

int W, H;
char star[1000][1000];
bool flag[1000][1000];
int x[2];
int y[2];
int ans_x;
int ans_y;
int num;

int main() {
	cin >> H>>W;
	num = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> star[i][j];
			if (star[i][j] == '*') {
				flag[i][j] = true;
				x[num] = j;
				y[num] = i;
				num++;
			}
		}
	}
	if (x[0] == 0 && x[1] == 0) {
		ans_x = 1;
		ans_y = 0;
	}
	else if (y[0] == 0 && y[1] == 0) {
		ans_x = 0;
		ans_y = 1;
	}
	else {
		ans_x = 0;
		ans_y = 0;
	}
	flag[ans_y][ans_x] = true;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (flag[i][j])cout << "*";
			else cout << "-";
		}
		cout << "\n";
	}
	return 0;
}
0