Content deleted Content added
(6 intermediate revisions by 3 users not shown) | |||
Line 81:
printf("%d %.16g\n", i, y);
}
}
</syntaxhighlight>
Line 92 ⟶ 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, "TOO LARGE" if y > 400
</syntaxhighlight>
Line 109 ⟶ 105:
<syntaxhighlight lang="Rust" line>
use std
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
*t = input.unwrap().parse().unwrap();
}
a.
Some(y) => println!("{i} {y}"),
});
}
Line 131 ⟶ 128:
{{reflist|refs=
<ref name="edpl">Luis Trabb Pardo and Donald E. Knuth, "The Early Development of Programming Languages".
* First published August 1976 in [https://web.archive.org/web/20131102050629/http://www.textfiles.com/bitsavers/pdf/stanford/cs_techReports/STAN-CS-76-562_EarlyDevelPgmgLang_Aug76.pdf typewritten draft form, as Stanford CS Report STAN-CS-76-562]
* Published in ''Encyclopedia of Computer Science and Technology'', Jack Belzer, Albert G. Holzman, and [[Allen Kent]] (eds.), Vol. 6, pp. 419-493. Dekker, New York, 1977.
* Reprinted ({{doi|10.1016/B978-0-12-491650-0.50019-8}}) in ''A History of Computing in the Twentieth Century'', [[N. Metropolis]], [[Jack Howlett|J. Howlett]], and [[G.-C. Rota]] (eds.), New York, Academic Press, 1980. {{ISBN|0-12-491650-3}}
|