結果
| 問題 |
No.1624 三角形の反射
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-08-05 01:29:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,274 bytes |
| コンパイル時間 | 1,461 ms |
| コンパイル使用メモリ | 92,784 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-09-16 15:13:51 |
| 合計ジャッジ時間 | 4,496 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | TLE * 1 -- * 21 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
long double a;
cin >> a;
if (a > 1) {
cout << "B ";
}
else if (a < 1) {
cout << "C ";
}
else {
cout << "A 1" << endl;
return 0;
}
for (long double i = 1;; i++) {
if (a * i == floor(a * i)) {
int ans = (a + 1) * i - 2;
for (long double j = 0; j <= a * i; j++) {
for (long double k = 0; k <= i; k++) {
long double x1 = 0, y1 = 0;
long double x2 = a * i, y2 = i;
long double x3 = j, y3 = k;
long double x4, y4;
if (int(floor(j + k)) % 2 == 0) {
x4 = j + 1, y4 = k - 1;
}
else {
x4 = j + 1, y4 = k + 1;
}
long double s = (x1 - x2) * (y3 - y1) + (y1 - y2) * (x1 - x3);
long double t = (x1 - x2) * (y4 - y1) + (y1 - y2) * (x1 - x4);
long double s1 = (x3 - x4) * (y1 - y3) + (y3 - y4) * (x3 - x1);
long double t1 = (x3 - x4) * (y2 - y3) + (y3 - y4) * (x3 - x2);
if (s * t < 0 && s1 * t1 < 0) {
ans++;
}
}
}
cout << ans << endl;
return 0;
}
}
}