Content deleted Content added
No edit summary |
No edit summary |
||
Line 62:
</syntaxhighlight>
==[[Python
This shows a Python implementation.
Line 78:
else:
print(i, y)
</syntaxhighlight>
==[[Rust (programming language)|Rust]]==
This shows a Rust implementation.
<syntaxhighlight lang="Rust" line>
use std::io::{stdin, BufRead};
fn f(t: f64) -> f64 {
t.abs().sqrt() + 5.0 * t.powi(3)
}
fn main() {
let mut a = [0f64; 11];
for (t, input) in a.iter_mut().zip(stdin().lock().lines()) {
*t = input.unwrap().parse().unwrap();
}
for (i, &t) in a.iter().enumerate().rev() {
match f(t) {
y if y > 400.0 => println!("{} TOO LARGE", i),
y => println!("{} {}", i, y),
}
}
}
</syntaxhighlight>
|