Skip to content

Commit ce34b95

Browse files
committed
Modify an example
1 parent e476467 commit ce34b95

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

examples/abc129-f.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ fn main() {
2222
MOD.with(|cell| cell.set(m));
2323

2424
let count = |d| -> _ {
25-
let count = |sup: u64| cmp::min(sup.saturating_sub(a + 1) / b + u64::from(b < sup), l);
25+
let count =
26+
|above: u64| cmp::min(above.saturating_sub(a + 1) / b + u64::from(b < above), l);
2627
count(10u64.pow(d)) - count(10u64.pow(d - 1))
2728
};
2829

@@ -65,12 +66,8 @@ thread_local! {
6566
struct Z(u64);
6667

6768
impl Z {
68-
fn checked(mut val: u64) -> Self {
69-
let modulus = MOD.with(Cell::get);
70-
if val >= modulus {
71-
val %= modulus;
72-
}
73-
Self(val)
69+
fn checked(val: u64) -> Self {
70+
Self(val % MOD.with(Cell::get))
7471
}
7572
}
7673

0 commit comments

Comments
 (0)