結果
問題 |
No.455 冬の大三角
|
ユーザー |
|
提出日時 | 2016-12-06 01:18:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,068 bytes |
コンパイル時間 | 528 ms |
コンパイル使用メモリ | 65,792 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-28 03:07:11 |
合計ジャッジ時間 | 2,216 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 53 WA * 1 |
コンパイルメッセージ
main.cpp:5:18: warning: extra tokens at end of #include directive 5 | #include <string>; | ^ main.cpp:6:20: warning: extra tokens at end of #include directive 6 | #include <iostream>; | ^
ソースコード
// ConsoleApplication4.cpp : Defines the entry point for the console application. // //#include "stdafx.h" #include <string>; #include <iostream>; using namespace std; const int maxH = 100; const int maxW = 100; string table[maxH]; int main() { int H, W; cin >> H >> W; for (int i = 0; i < H; ++i) { cin >> table[i]; } int x[2]; int y[2]; int c = 0; for (int i = 0; i < H; ++i) { for (int j = 0; j < W; ++j) { if (table[i][j] == '*') { y[c] = i; x[c] = j; ++c; } } } if (x[0] > x[1]) { swap(x[0], x[1]); swap(y[0], y[1]); } int px = -1, py = -1; for (int i = 0; i < H; ++i) { for (int j = 0; j < W; ++j) { if (table[i][j] == '*')continue; if (x[0] == x[1] && x[1] == j)continue; if (y[0] == y[1] && y[1] == i)continue; if ((x[0] - x[1])*(x[0] - j) != (y[0] - y[1])*(y[0] - i)) { px = j; py = i; goto out; } } } out: for (int i = 0; i < H; ++i) { for (int j = 0; j < W; ++j) { if (i == py&&j == px) cout << '*'; else cout << table[i][j]; } cout << endl; } return 0; }