update user module to 2021autumn version
This commit is contained in:
parent
92d9170fca
commit
b03d06c330
29 changed files with 964 additions and 78 deletions
28
user/src/bin/power_7.rs
Normal file
28
user/src/bin/power_7.rs
Normal file
|
@ -0,0 +1,28 @@
|
|||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
#[macro_use]
|
||||
extern crate user_lib;
|
||||
|
||||
const LEN: usize = 100;
|
||||
|
||||
#[no_mangle]
|
||||
fn main() -> i32 {
|
||||
let p = 7u64;
|
||||
let m = 998244353u64;
|
||||
let iter: usize = 160000;
|
||||
let mut s = [0u64; LEN];
|
||||
let mut cur = 0usize;
|
||||
s[cur] = 1;
|
||||
for i in 1..=iter {
|
||||
let next = if cur + 1 == LEN { 0 } else { cur + 1 };
|
||||
s[next] = s[cur] * p % m;
|
||||
cur = next;
|
||||
if i % 10000 == 0 {
|
||||
println!("power_7 [{}/{}]", i, iter);
|
||||
}
|
||||
}
|
||||
println!("{}^{} = {}(MOD {})", p, iter, s[cur], m);
|
||||
println!("Test power_7 OK!");
|
||||
0
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue