summaryrefslogtreecommitdiff
path: root/2025/01
diff options
context:
space:
mode:
authormhsn <mail@mhsn.net>2026-03-18 21:48:13 +0000
committermhsn <mail@mhsn.net>2026-03-18 21:48:13 +0000
commit86bac31392a76da84817eec020d2b84d099b3cc1 (patch)
treee2ee52db59b86b914d5b4bcceb19c9b5d899fff4 /2025/01
parent62fe361fc42dea75deaf7ac31c0ba6ba80e26a9c (diff)
downloadpuzzles-master.tar.gz
puzzles-master.zip
add other challenges supportHEADmaster
Diffstat (limited to '2025/01')
-rw-r--r--2025/01/c.c19
-rwxr-xr-x2025/01/python.py15
-rw-r--r--2025/01/rust/Cargo.lock89
-rw-r--r--2025/01/rust/Cargo.toml7
-rw-r--r--2025/01/rust/src/main.rs25
5 files changed, 0 insertions, 155 deletions
diff --git a/2025/01/c.c b/2025/01/c.c
deleted file mode 100644
index 115ea13..0000000
--- a/2025/01/c.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-int main()
-{
- char dir;
- int64_t n;
- int64_t p = 50;
- int64_t p1 = 0, p2 = 0;
- while (scanf("%c%ld ", &dir, &n) == 2) {
- int64_t new = p + (dir == 'R' ? n : -n);
- p2 += labs(new) / 100 + (p != 0 && new <= 0);
- p = (p = new % 100) >= 0 ? p : p + 100;
- p1 += p == 0;
- }
- printf("silver: %ld\ngold: %ld", p1, p2);
- return 0;
-}
diff --git a/2025/01/python.py b/2025/01/python.py
deleted file mode 100755
index d5ff1fa..0000000
--- a/2025/01/python.py
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env python3
-
-from fileinput import input
-from itertools import accumulate
-
-
-def fn(p: tuple[int, int], rot: str) -> tuple[int, int]:
- x = p[0] + int(rot[1:]) * (1 if rot[0] == "R" else -1)
- return x % 100, abs(x) // 100 + (p[0] and x <= 0)
-
-
-p1, p2 = zip(*list(accumulate(input(), fn, initial=(50, 0))))
-
-print(f"silver: {sum(not p for p in p1)}")
-print(f"gold: {sum(p2)}")
diff --git a/2025/01/rust/Cargo.lock b/2025/01/rust/Cargo.lock
deleted file mode 100644
index 15ca0d7..0000000
--- a/2025/01/rust/Cargo.lock
+++ /dev/null
@@ -1,89 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-version = 4
-
-[[package]]
-name = "aoc_2025-01"
-version = "0.1.0"
-dependencies = [
- "num",
-]
-
-[[package]]
-name = "autocfg"
-version = "1.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
-
-[[package]]
-name = "num"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23"
-dependencies = [
- "num-bigint",
- "num-complex",
- "num-integer",
- "num-iter",
- "num-rational",
- "num-traits",
-]
-
-[[package]]
-name = "num-bigint"
-version = "0.4.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
-dependencies = [
- "num-integer",
- "num-traits",
-]
-
-[[package]]
-name = "num-complex"
-version = "0.4.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
-dependencies = [
- "num-traits",
-]
-
-[[package]]
-name = "num-integer"
-version = "0.1.46"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
-dependencies = [
- "num-traits",
-]
-
-[[package]]
-name = "num-iter"
-version = "0.1.45"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"
-dependencies = [
- "autocfg",
- "num-integer",
- "num-traits",
-]
-
-[[package]]
-name = "num-rational"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
-dependencies = [
- "num-bigint",
- "num-integer",
- "num-traits",
-]
-
-[[package]]
-name = "num-traits"
-version = "0.2.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
-dependencies = [
- "autocfg",
-]
diff --git a/2025/01/rust/Cargo.toml b/2025/01/rust/Cargo.toml
deleted file mode 100644
index 901af57..0000000
--- a/2025/01/rust/Cargo.toml
+++ /dev/null
@@ -1,7 +0,0 @@
-[package]
-name = "aoc_2025-01"
-version = "0.1.0"
-edition = "2024"
-
-[dependencies]
-num = { version = "0.4.3", features = ["num-bigint"] }
diff --git a/2025/01/rust/src/main.rs b/2025/01/rust/src/main.rs
deleted file mode 100644
index 72b718b..0000000
--- a/2025/01/rust/src/main.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-use num::BigUint;
-use std::io;
-
-fn main() {
- let mut curr = 50;
- let mut silver: u64 = 0;
- let mut gold: BigUint = BigUint::ZERO;
- io::stdin()
- .lines()
- .flatten()
- .map(|line| match line.split_at(1) {
- ("L", n) => -n.parse::<i64>().unwrap(),
- (_, n) => n.parse::<i64>().unwrap(),
- })
- .for_each(|n| {
- let prev = curr;
- curr += n;
- gold += (curr.abs() / 100) as u64 + (prev != 0 && curr <= 0) as u64;
- curr = curr.rem_euclid(100);
- silver += (curr == 0) as u64;
- });
-
- println!("silver: {silver}");
- println!("gold: {gold}");
-}