File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ // https://atcoder.jp/contests/abc168/tasks/abc168_c
2
+ //
3
+ // 以下のクレートを使用。
4
+ // - `num`
5
+ // - `num-complex`
6
+ // - `proconio`
7
+
8
+ use num:: Complex ;
9
+ use proconio:: input;
10
+ use std:: f64:: consts:: PI ;
11
+
12
+ fn main ( ) {
13
+ // `proconio::input!`。
14
+ //
15
+ // https://docs.rs/proconio/0.3.6/proconio/macro.input.html
16
+ input ! {
17
+ a: f64 ,
18
+ b: f64 ,
19
+ h: f64 ,
20
+ m: f64 ,
21
+ }
22
+
23
+ // 座標として`num_complex::Complex<f64>`を使う。
24
+ // `Complex::from_polar`でxとθから(x・cosθ, x・sinθ)を得ることができ、また`Complex::norm`で2点間の距離を出すことができる。
25
+ //
26
+ // https://docs.rs/num-complex/0.2.4/num_complex/struct.Complex.html
27
+ // https://docs.rs/num-complex/0.2.4/num_complex/struct.Complex.html#method.from_polar
28
+ // https://docs.rs/num-complex/0.2.4/num_complex/struct.Complex.html#method.norm
29
+
30
+ let p1 = Complex :: from_polar ( & a, & ( h * PI / 6.0 + m * PI / 360.0 ) ) ;
31
+ let p2 = Complex :: from_polar ( & b, & ( m * PI / 30.0 ) ) ;
32
+ let ans = ( p1 - p2) . norm ( ) ;
33
+ println ! ( "{}" , ans) ;
34
+ }
Original file line number Diff line number Diff line change @@ -261,6 +261,13 @@ url = "https://atcoder.jp/contests/abc168/tasks/abc168_b"
261
261
matching = " Words"
262
262
meta = { using = [" ascii" , " proconio" ] }
263
263
264
+ [examples .abc168-c ]
265
+ type = " Normal"
266
+ name = " ABC168 - C - : (Colon)"
267
+ url = " https://atcoder.jp/contests/abc168/tasks/abc168_c"
268
+ matching = { FloatOr = { abs = 1e-9 , rel = 1e-9 } }
269
+ meta = { using = [" num" , " proconio" ] }
270
+
264
271
[examples .agc020-c ]
265
272
type = " Normal"
266
273
name = " AGC020: C - Median Sum"
You can’t perform that action at this time.
0 commit comments