1
0
This commit is contained in:
2026-02-04 11:15:03 +08:00
commit 8b20a5dd21
125 changed files with 4177 additions and 0 deletions

25
problems/p13/src/main.rs Normal file
View File

@@ -0,0 +1,25 @@
use std::{
fs::File,
io::{BufRead, BufReader},
str::FromStr,
};
use anyhow::Result;
use num_bigint::BigUint;
fn main() -> Result<()> {
let file = File::open("p13/input.txt")?;
let reader = BufReader::new(file);
let mut numbers: Vec<BigUint> = Vec::new();
for line in reader.lines() {
let line = line?;
let trimmed = line.trim();
if !trimmed.is_empty() {
let big_num = BigUint::from_str(trimmed).unwrap();
numbers.push(big_num);
}
}
let result: BigUint = numbers.iter().sum();
println!("{result}");
Ok(())
}