結果
| 問題 | No.316 もっと刺激的なFizzBuzzをください |
| コンテスト | |
| ユーザー |
cra77756176
|
| 提出日時 | 2022-12-11 21:26:51 |
| 言語 | Rust (1.97.1 + proconio + num + itertools + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 0 ms / 1,000 ms |
| + 929µs | |
| コード長 | 650 bytes |
| 記録 | |
| コンパイル時間 | 10,559 ms |
| コンパイル使用メモリ | 174,452 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-09-18 18:36:31 |
| 合計ジャッジ時間 | 13,168 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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])
);
}
cra77756176