mirror of
https://github.com/cupcakearmy/advent-of-code.git
synced 2024-12-21 23:56:30 +00:00
add rust
This commit is contained in:
parent
14d00e16d5
commit
3af5af2461
4
.gitignore
vendored
4
.gitignore
vendored
@ -2,3 +2,7 @@
|
|||||||
node_modules
|
node_modules
|
||||||
*.txt
|
*.txt
|
||||||
.env*
|
.env*
|
||||||
|
|
||||||
|
|
||||||
|
# Added by cargo
|
||||||
|
/target
|
||||||
|
10
2022/01/rust/main.rs
Normal file
10
2022/01/rust/main.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fn main() {
|
||||||
|
// Part A
|
||||||
|
let result: u32 = include_str!("../input.txt")
|
||||||
|
.trim()
|
||||||
|
.split("\n\n")
|
||||||
|
.map(|x| x.lines().map(|x| x.parse::<u32>().unwrap()).sum())
|
||||||
|
.max()
|
||||||
|
.unwrap();
|
||||||
|
println!("A: {}", result);
|
||||||
|
}
|
7
Cargo.lock
generated
Normal file
7
Cargo.lock
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "advent-of-code"
|
||||||
|
version = "0.1.0"
|
11
Cargo.toml
Normal file
11
Cargo.toml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[package]
|
||||||
|
name = "advent-of-code"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "2022-01"
|
||||||
|
path = "./2022/01/rust/main.rs"
|
Loading…
Reference in New Issue
Block a user