-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.rs
More file actions
22 lines (20 loc) · 597 Bytes
/
main.rs
File metadata and controls
22 lines (20 loc) · 597 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#![feature(str_split_once)]
#[rustfmt::skip]
pub fn main() {
let (d, c) = include_str!("../input.txt").trim().split_once('\n').unwrap();
let (d, c): (u64, u64) = (d.parse().unwrap(), c.parse().unwrap());
let (mut pk1, mut pk2, mut ek1, mut ek2) = (1, 1, 1, 1);
loop {
pk1 = pk1 * 7 % 20201227;
pk2 = pk2 * 7 % 20201227;
ek1 = ek1 * d % 20201227;
ek2 = ek2 * c % 20201227;
if pk1 == c {
println!("{}", ek1);
return;
} else if pk2 == d {
println!("{}", ek2);
return;
}
}
}