>>328-329
なんかダサい
https://paiza.io/projects/uc8gH6yNWCWKdQSYtqNREg
pub fn f(x: i32) -> i32 {
(
-2413f64*(x.pow(6) as f64)/120960f64
+739f64*(x.pow(5) as f64)/1260f64
-157991f64*(x.pow(4) as f64)/24192f64
+69551f64*(x.pow(3) as f64)/2016f64
-2691673f64*(x.pow(2) as f64)/30240f64
+88679f64*(x as f64)/840f64
-905f64/21f64
+0.5)
as i32
}
pub fn g(y: i32) -> i32 {
(
13f64*(y.pow(6) as f64)/120960f64
-(y.pow(5) as f64)/315f64
+1415f64*(y.pow(4) as f64)/24192f64
-1511f64*(y.pow(3) as f64)/2016f64
+144793f64*(y.pow(2) as f64)/30240f64
-3053f64*(y as f64)/280f64
+185f64/21f64
+0.5)
as i32
}
pub fn main() {
let a = vec![(1, 2), (2, 1), (3, 3), (4, 10), (6, 4), (8, 8), (10, 6)];
for (x, _y) in &a { println!("{}, {}", x, f(*x)); }
for (_x, y) in &a { println!("{}, {}", y, g(*y)); }
}