結果
| 問題 |
No.455 冬の大三角
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-07 15:54:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,239 bytes |
| コンパイル時間 | 622 ms |
| コンパイル使用メモリ | 67,692 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-29 21:18:49 |
| 合計ジャッジ時間 | 2,451 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 54 |
コンパイルメッセージ
main.cpp:6:18: warning: extra tokens at end of #include directive
6 | #include <string>;
| ^
main.cpp:7:20: warning: extra tokens at end of #include directive
7 | #include <iostream>;
| ^
ソースコード
// ConsoleApplication8.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
// ConsoleApplication4.cpp : Defines the entry point for the console application.
//
#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])*(y[0] - i) != (y[0] - y[1])*(x[0] - j) && (x[1] - x[0])*(y[1] - i) != (y[1] - y[0])*(x[1] - j) ) {
px = j;
py = i;
goto out;
}
}
}
out:
cout << endl;
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;
}