Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[FizzBuzz を無駄にベンチマークしてみた By Nim、golang、Rust、Crystal、その他 - 強まっていこう]: http://wolfbash.hateblo.jp/entry/2017/07/25/232027 を見て高速化させてみました
fn main() {
let mut s = String::new();
for i in 1..600000 {
if i % 3 == 0 && i % 5 == 0 {
s += "FizzBuzz\n";
} else if i % 3 == 0 {
s += "Fizz\n";
} else if i % 5 == 0 {
s += "Buzz\n";
} else {
s += i.to_string().as_str();
s += "\n";
}
}
print!("{}", s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.