complete 11401.rs 13171.rs 13172.rs 13977.rs

This commit is contained in:
2026-03-23 16:25:42 +09:00
parent 8bb3631ff6
commit 4e380a44ac
4 changed files with 160 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
use std::io::{read_to_string, stdin};
const MOD: usize = 1_000_000_007;
fn main() {
let temp = read_to_string(stdin()).unwrap();
let mut iter = temp.split_ascii_whitespace().map(|x| x.parse::<usize>().unwrap());
let a = iter.next().unwrap();
let mut x = iter.next().unwrap();
let mut res = 1;
let mut curr = a % MOD;
while x > 0 {
if x & 1 == 1usize {
res *= curr;
res %= MOD;
}
x >>= 1;
curr *= curr;
curr %= MOD;
}
println!("{}", res);
}