Content deleted Content added
(3 intermediate revisions by 2 users not shown) | |||
Line 89:
<syntaxhighlight lang="python" line>
from math import sqrt
def f(t):
return sqrt(abs(t)) + 5 * t
a = [float(input()) for _ in range(11)]
for i, t in reversed(list(enumerate(a))):
y = f(t)
print(i,
</syntaxhighlight>
Line 103 ⟶ 105:
<syntaxhighlight lang="Rust" line>
use std::{io, iter
fn f(t: f64) -> Option<f64> {
let y = t.abs().sqrt() + 5.0 * t.powi(3);
(y <= 400.0).then_some(y)
}
fn main() {
let mut a = [0f64; 11];
for (t, input) in iter::zip(&mut a, io::stdin().lines()) {
*t = input.unwrap().parse().unwrap();
}
a.iter().enumerate().rev().for_each(|(i, &t)| match f(t) {
Some(y) => println!("{i} {y}"),
});
}
|