Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
99e3a47d63 | |||
973f6b1856 | |||
7fe1a60dc2 |
2
LICENSE
2
LICENSE
@ -1,4 +1,4 @@
|
||||
Copyright (c) <year> <owner>
|
||||
Copyright (c) 2022, apio
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
|
300
src/input.txt
Normal file
300
src/input.txt
Normal file
@ -0,0 +1,300 @@
|
||||
BccTFfTPTsffdDDqsq
|
||||
lGGLQwFhDgWdqvhW
|
||||
wbLNjGjlwLFrpSbllrHnHHRmmJVBmZJRRVcBTc
|
||||
vvGLllBBLtllJnJFMZNjFcNG
|
||||
bdhrhTgmhRrpLJMMNJgNffnf
|
||||
qhRmTpzpzVzmTTbmVhWWWpVvDtsLVlwBVHvSsDCvvBDl
|
||||
sLlhhthVRndBZzwBdV
|
||||
PfmsPsqsGFqrSQpqBDDwpddDDM
|
||||
mFjvSFrjPSvLJWvbRssN
|
||||
gWnWQtMMDQbQvMDjjcwsvqcwsSSqZq
|
||||
HzPJTtmtZJJsqfBJ
|
||||
hCFPrNNPVNzFtQhdQMWRhhDd
|
||||
sNhmsQZdNdsztNpHGCdjcBcwCvGvCv
|
||||
brSlRfFFppHwfTpf
|
||||
MbRlRpqMnqRpMhVtsQQQVWsM
|
||||
HsdttdfHrHrwdhftMHMSDnJFwlQSgQZQZggZSW
|
||||
LjCTqBCmmmTqgFQQFQjlnnDJ
|
||||
GCTLBCmTBDBDPTTzqLCBpVcctcHbtbrcMMsdsdtcPtdb
|
||||
QnJLdNLfLRQjpLlPflfQnlnswRvwsHVWVHWVVDZwWHcrwV
|
||||
zFbgtqCBhtgBhsDZVDNHwvDv
|
||||
zgCGCFCFGtMpJjlGTnlnLN
|
||||
ZFhJZbvZVmFpFnJbnZFbLnbHPrjjQdBdCrMPQMQHrrrrVC
|
||||
gTzlqmNlTflmtTRHdDPqMjHDMrjdQd
|
||||
wcRSwglcNSwgWmN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TrJtbZrBvWHVVvHbPQW
|
||||
djcrrBljMrTdCTcdCClClMlqRvtNqqSRwFbNbwvNBNpSzq
|
||||
QhPmGJnPVGVHHNzSqpzFwztF
|
||||
nhgPFmsnLPGLhPDJhGTcDjMfrMMjMZWfjfWj
|
77
src/main.rs
77
src/main.rs
@ -1,3 +1,76 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
// https://adventofcode.com/2022/day/3
|
||||
#![feature(iter_array_chunks)]
|
||||
|
||||
const DATA: &'static str = include_str!("input.txt");
|
||||
|
||||
fn item_priority(item: char) -> u8
|
||||
{
|
||||
if item.is_lowercase() {
|
||||
((item.to_ascii_lowercase() as u8) - ('a'.to_ascii_lowercase() as u8)) + 1
|
||||
} else {
|
||||
((item.to_ascii_uppercase() as u8) - ('A'.to_ascii_uppercase() as u8)) + 27
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn part1()
|
||||
{
|
||||
let mut priority_sum = 0;
|
||||
for slice in DATA.split("\n")
|
||||
{
|
||||
if slice.is_empty() { continue; }
|
||||
|
||||
let (left, right) = slice.split_at(slice.len() / 2);
|
||||
|
||||
for c in left.chars().into_iter()
|
||||
{
|
||||
if right.contains(c)
|
||||
{
|
||||
priority_sum += item_priority(c) as u32;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
println!("The sum of the priorities of duplicate item types is {}", priority_sum);
|
||||
}
|
||||
|
||||
fn part2()
|
||||
{
|
||||
let mut priority_sum = 0;
|
||||
for slice in DATA.split("\n").array_chunks::<3>()
|
||||
{
|
||||
let left = slice[0];
|
||||
let mid = slice[1];
|
||||
let right = slice[2];
|
||||
|
||||
for c in left.chars().into_iter()
|
||||
{
|
||||
if mid.contains(c) && right.contains(c)
|
||||
{
|
||||
priority_sum += item_priority(c) as u32;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
println!("The sum of the priorities of team badges is {}", priority_sum);
|
||||
}
|
||||
|
||||
fn main()
|
||||
{
|
||||
//part1()
|
||||
part2()
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_item_priority() {
|
||||
assert_eq!(item_priority('a'), 1);
|
||||
assert_eq!(item_priority('z'), 26);
|
||||
assert_eq!(item_priority('A'), 27);
|
||||
assert_eq!(item_priority('Z'), 52);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user