Created
October 3, 2017 10:02
-
-
Save ncaq/b3c694957206ee2a1ed52f4c197b2b5d to your computer and use it in GitHub Desktop.
[FizzBuzz を無駄にベンチマークしてみた By Nim、golang、Rust、Crystal、その他 - 強まっていこう]: http://wolfbash.hateblo.jp/entry/2017/07/25/232027 を見て高速化させてみました
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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