回答編集履歴
1
追記
test
CHANGED
@@ -11,3 +11,67 @@
|
|
11
11
|
|
12
12
|
|
13
13
|
こいつら全部 複素数クラス: [std::complex<double>](https://cpprefjp.github.io/reference/complex/complex.html) で解決しそうです。
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
[追記] ものは試しに書いてみた:
|
18
|
+
|
19
|
+
```C++
|
20
|
+
|
21
|
+
#include <iostream>
|
22
|
+
|
23
|
+
#include <fstream>
|
24
|
+
|
25
|
+
#include <complex>
|
26
|
+
|
27
|
+
#include <string>
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
int main() {
|
32
|
+
|
33
|
+
std::string _9th_in =
|
34
|
+
|
35
|
+
"3 4 3\n"
|
36
|
+
|
37
|
+
"3\n"
|
38
|
+
|
39
|
+
"0 0 \n"
|
40
|
+
|
41
|
+
"1 2 \n"
|
42
|
+
|
43
|
+
"3 4 \n";
|
44
|
+
|
45
|
+
std::istringstream stream(_9th_in);
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
double x, y, r;
|
50
|
+
|
51
|
+
stream >> x >> y >> r;
|
52
|
+
|
53
|
+
std::complex<double> p(x,y);
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
int n;
|
58
|
+
|
59
|
+
stream >> n;
|
60
|
+
|
61
|
+
while ( n-- ) {
|
62
|
+
|
63
|
+
stream >> x >> y;
|
64
|
+
|
65
|
+
std::complex<double> q(x,y);
|
66
|
+
|
67
|
+
double distance = std::abs(p-q); // q-p間の距離
|
68
|
+
|
69
|
+
std::cout << p << ':' << q << " " << distance << " : "
|
70
|
+
|
71
|
+
<< std::boolalpha << (distance < r) << std::endl;
|
72
|
+
|
73
|
+
}
|
74
|
+
|
75
|
+
}
|
76
|
+
|
77
|
+
```
|