結果
問題 | No.316 もっと刺激的なFizzBuzzをください |
ユーザー |
![]() |
提出日時 | 2022-12-11 21:26:51 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 650 bytes |
コンパイル時間 | 18,055 ms |
コンパイル使用メモリ | 403,176 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 16:54:35 |
合計ジャッジ時間 | 13,583 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
const fn gcd(a: u64, b: u64) -> u64 {let mut x = (a, b);while x.1 > 0 {x = (x.1, x.0 % x.1);}x.0}const fn lcm(a: u64, b: u64) -> u64 {a * b / gcd(a, b)}fn main() {let mut xx = String::new();std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok();let xx: Vec<u64> = xx.split_whitespace().flat_map(str::parse).collect();println!("{}",xx[0] / xx[1] + xx[0] / xx[2] + xx[0] / xx[3]- xx[0] / lcm(xx[1], xx[2])- xx[0] / lcm(xx[1], xx[3])- xx[0] / lcm(xx[2], xx[3])+ xx[0] / lcm(lcm(xx[1], xx[2]), xx[3]));}