Skip to content

Commit

Permalink
Add yukicoder/2489-ex.rs yukicoder/2489.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
koba-e964 committed Dec 19, 2023
1 parent 6b316a4 commit 104d313
Show file tree
Hide file tree
Showing 2 changed files with 402 additions and 0 deletions.
27 changes: 27 additions & 0 deletions yukicoder/2489-ex.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
mod inner {
include!("2489.rs");
pub type MIntPub = MInt;
}

fn main() {
let m = 157;
let mut k = 0;
while (1 << k) < m {
k += 1;
}
for i in 0..k {
let mut expected_c = inner::MIntPub::new(0);
for x in 0..m {
expected_c += x ^ (1 << i);
expected_c -= x;
}
assert_eq!(expected_c, inner::c(m, i), "m = {}, i = {}", m, i);
let mut expected_e = inner::MIntPub::new(0);
for x in 0..m {
if (x & (1 << i)) != 0 {
expected_e += x;
}
}
assert_eq!(expected_e, inner::e(m, i), "m = {}, i = {}", m, i);
}
}
Loading

0 comments on commit 104d313

Please sign in to comment.