Skip to content

Commit e060343

Browse files
committed
Add an example for ABC150-D
1 parent 9a90619 commit e060343

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

examples/abc150-d.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// https://atcoder.jp/contests/abc150/tasks/abc150_d
2+
3+
use itertools::Itertools as _;
4+
5+
use std::io::{self, Read as _};
6+
7+
fn main() {
8+
let mut input = "".to_owned();
9+
io::stdin().read_to_string(&mut input).unwrap();
10+
let mut input = input.split_whitespace();
11+
macro_rules! read {
12+
([$tt:tt; $n:expr]) => {
13+
(0..$n).map(|_| read!($tt)).collect::<Vec<_>>()
14+
};
15+
(($($tt:tt),+)) => {
16+
($(read!($tt)),*)
17+
};
18+
($ty:ty) => {
19+
input.next().unwrap().parse::<$ty>().unwrap()
20+
};
21+
}
22+
23+
let (n, m) = read!((usize, usize));
24+
let a = read!([usize; n]);
25+
26+
if !a.iter().map(|v| v.trailing_zeros()).all_equal() {
27+
println!("0");
28+
return;
29+
}
30+
31+
let x_min = a.iter().fold(1, |acc, &v| num::integer::lcm(acc, v)) / 2;
32+
let ans = (m + x_min) / (2 * x_min);
33+
println!("{}", ans);
34+
}

test-with-generated-opts.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ name = "ABC144: D - Water Bottle"
4848
url = "https://atcoder.jp/contests/abc144/tasks/abc144_d"
4949
matching = { FloatOr = { abs = 1e-6, rel = 1e-6 } }
5050

51+
[examples.abc150-d]
52+
name = "ABC150: D - Semi Common Multiple"
53+
url = "https://atcoder.jp/contests/abc150/tasks/abc150_d"
54+
matching = "Words"
55+
5156
[examples.apg4b-a]
5257
name = "APG4b: A - 1.00.はじめに"
5358
url = "https://atcoder.jp/contests/APG4b/tasks/APG4b_a"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy