結果
問題 |
No.455 冬の大三角
|
ユーザー |
|
提出日時 | 2016-12-06 13:35:45 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 824 bytes |
コンパイル時間 | 578 ms |
コンパイル使用メモリ | 65,020 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-28 01:59:07 |
合計ジャッジ時間 | 2,668 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 51 WA * 3 |
ソースコード
#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 if (x[1] - x[0] == y[1] - y[0]) { ans_x = 1; ans_y = 0; } 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; }