Skip to content

Commit 4f3bf8d

Browse files
committed
Add an example for sumitrust2019-C
1 parent 39e78ae commit 4f3bf8d

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

examples/sumitrust2019-c.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_c
2+
3+
use defmac::defmac;
4+
use fixedbitset::FixedBitSet;
5+
6+
use std::io::{self, Read as _};
7+
8+
fn main() {
9+
let mut input = "".to_owned();
10+
io::stdin().read_to_string(&mut input).unwrap();
11+
let mut input = input.split_whitespace();
12+
defmac!(read => input.next().unwrap().parse().unwrap());
13+
14+
let x: usize = read!();
15+
16+
let mut dp = FixedBitSet::with_capacity(x + 105);
17+
dp.insert(0);
18+
for i in 0..=x.saturating_sub(100) {
19+
if dp[i] {
20+
// `insert_range` does not accept `RangeInclusive<usize>`.
21+
dp.insert_range(i + 100..i + 106);
22+
}
23+
}
24+
println!("{}", u32::from(dp[x]));
25+
}

test-with-generated-opts.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,8 @@ matching = "Words"
8383
name = "ATC002: B - n^p mod m"
8484
url = "https://atcoder.jp/contests/atc002/tasks/atc002_b"
8585
matching = "Words"
86+
87+
[examples.sumitrust2019-c]
88+
name = "Sumitomo Mitsui Trust Bank Programming Contest 2019: C - 100 to 105"
89+
url = "https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_c"
90+
matching = "Words"

0 commit comments

Comments
 (0)