結果
問題 |
No.455 冬の大三角
|
ユーザー |
![]() |
提出日時 | 2016-12-05 22:13:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 671 bytes |
コンパイル時間 | 1,304 ms |
コンパイル使用メモリ | 162,380 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 20:57:39 |
合計ジャッジ時間 | 2,798 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 54 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef complex<double> P; int main() { int h, w; cin >> h >> w; vector<string> s(h); vector<P> star(3); int cnt = 0; for (int i = 0; i < h; i++) { cin >> s[i]; for (int j = 0; j < w; j++) { if (s[i][j] == '*') star[cnt++] = P(i, j); } } while (true) { star[2] = P(rand() % h, rand() % w); P vec1 = star[1] - star[0]; P vec2 = star[2] - star[0]; if (vec1.real() * vec2.imag() - vec1.imag() * vec2.real() != 0) { s[star[2].real()][star[2].imag()] = '*'; for (int i = 0; i < h; i++) { cout << s[i] << endl; } return 0; } } return 0; }