-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.rs
More file actions
36 lines (26 loc) · 668 Bytes
/
lib.rs
File metadata and controls
36 lines (26 loc) · 668 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use common::Answer;
type IntType = u64;
fn pow(mut base: IntType, mut exp: IntType, modulus: IntType) -> IntType {
let mut result = 1;
base %= modulus;
while exp > 0 {
if exp % 2 == 1 {
result = (result * base) % modulus;
}
base = (base * base) % modulus;
exp /= 2;
}
result
}
fn nth(row: IntType, col: IntType) -> IntType {
(row + col - 2) * (row + col - 1) / 2 + col
}
fn nth_code(n: IntType) -> IntType {
(20151125 * pow(252533, n - 1, 33554393)) % 33554393
}
pub fn step1(_: &str) -> Answer {
nth_code(nth(3010, 3019)).into()
}
pub fn step2(_: &str) -> Answer {
().into()
}