solved
This commit is contained in:
parent
dd9c8b44c4
commit
c88998e895
78 changed files with 32 additions and 15 deletions
|
|
@ -29,6 +29,7 @@ fn main() {
|
|||
|
||||
|
||||
for line in fs::read_to_string(file_path).unwrap().lines() {
|
||||
let start = safe_value;
|
||||
println!("{line}");
|
||||
print!("start {safe_value}, ");
|
||||
// get the letter and the number, put them in different variables
|
||||
|
|
@ -50,7 +51,7 @@ fn main() {
|
|||
else{
|
||||
safe_value += &caps["value"].parse::<i32>().unwrap();
|
||||
}
|
||||
|
||||
let after = safe_value;
|
||||
|
||||
// need to count how many times a number goes past a multiple of 100
|
||||
// 50 - 68 = -18, 1 count, return to 82
|
||||
|
|
@ -67,25 +68,30 @@ fn main() {
|
|||
// if i start on 0 it shouldnt count
|
||||
// if i end on 0 it should count?
|
||||
|
||||
let mut hits = (safe_value/100).abs();
|
||||
let mut hits = 0;
|
||||
// println!("counted {hits} hits");
|
||||
print!("after spin {safe_value}, ");
|
||||
if safe_value < 0{
|
||||
safe_value += 100 * hits
|
||||
|
||||
while safe_value >= 100{
|
||||
safe_value -= 100;
|
||||
hits += 1;
|
||||
}
|
||||
|
||||
if safe_value < 0{
|
||||
hits += 1;
|
||||
if safe_value < start && start == 0{
|
||||
hits -= 1;
|
||||
}
|
||||
|
||||
while safe_value < 0{
|
||||
safe_value += 100;
|
||||
// safe_value += 100 * hits;
|
||||
}
|
||||
else if safe_value >= 100{
|
||||
safe_value -= 100 * hits;
|
||||
hits += 1
|
||||
}
|
||||
|
||||
if safe_value == 0{
|
||||
if after < start && safe_value == 0{
|
||||
hits += 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
zero_hits += hits;
|
||||
println!("end {safe_value}");
|
||||
println!("hits: {hits}");
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"rustc_fingerprint":640939955106008076,"outputs":{"11857020428658561806":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/tabby/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"17747080675513052775":{"success":true,"status":"","code":0,"stdout":"rustc 1.91.1 (ed61e7d7e 2025-11-07)\nbinary: rustc\ncommit-hash: ed61e7d7e242494fb7057f2657300d9e77bb4fcb\ncommit-date: 2025-11-07\nhost: x86_64-unknown-linux-gnu\nrelease: 1.91.1\nLLVM version: 21.1.2\n","stderr":""},"7971740275564407648":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/tabby/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""}},"successes":{}}
|
||||
{"rustc_fingerprint":8298087884678720971,"outputs":{"7971740275564407648":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/tabby/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"17747080675513052775":{"success":true,"status":"","code":0,"stdout":"rustc 1.91.1 (ed61e7d7e 2025-11-07)\nbinary: rustc\ncommit-hash: ed61e7d7e242494fb7057f2657300d9e77bb4fcb\ncommit-date: 2025-11-07\nhost: x86_64-unknown-linux-gnu\nrelease: 1.91.1\nLLVM version: 21.1.2\n","stderr":""}},"successes":{}}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1,12 @@
|
|||
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.02s
|
||||
0.093562248s INFO prepare_target{force=false package_id=aoc-1b v0.1.0 (/home/tabby/rust-projects/aoc-1b) target="aoc-1b"}: cargo::core::compiler::fingerprint: stale: changed "/home/tabby/rust-projects/aoc-1b/src/main.rs"
|
||||
0.093577438s INFO prepare_target{force=false package_id=aoc-1b v0.1.0 (/home/tabby/rust-projects/aoc-1b) target="aoc-1b"}: cargo::core::compiler::fingerprint: (vs) "/home/tabby/rust-projects/aoc-1b/target/debug/.fingerprint/aoc-1b-917b8d9d404e499a/dep-bin-aoc-1b"
|
||||
0.093583051s INFO prepare_target{force=false package_id=aoc-1b v0.1.0 (/home/tabby/rust-projects/aoc-1b) target="aoc-1b"}: cargo::core::compiler::fingerprint: FileTime { seconds: 1764631767, nanos: 802321084 } < FileTime { seconds: 1764631785, nanos: 866379579 }
|
||||
0.093636471s INFO prepare_target{force=false package_id=aoc-1b v0.1.0 (/home/tabby/rust-projects/aoc-1b) target="aoc-1b"}: cargo::core::compiler::fingerprint: fingerprint dirty for aoc-1b v0.1.0 (/home/tabby/rust-projects/aoc-1b)/Check { test: false }/TargetInner { name: "aoc-1b", doc: true, ..: with_path("/home/tabby/rust-projects/aoc-1b/src/main.rs", Edition2024) }
|
||||
0.093647695s INFO prepare_target{force=false package_id=aoc-1b v0.1.0 (/home/tabby/rust-projects/aoc-1b) target="aoc-1b"}: cargo::core::compiler::fingerprint: dirty: FsStatusOutdated(StaleItem(ChangedFile { reference: "/home/tabby/rust-projects/aoc-1b/target/debug/.fingerprint/aoc-1b-917b8d9d404e499a/dep-bin-aoc-1b", reference_mtime: FileTime { seconds: 1764631767, nanos: 802321084 }, stale: "/home/tabby/rust-projects/aoc-1b/src/main.rs", stale_mtime: FileTime { seconds: 1764631785, nanos: 866379579 } }))
|
||||
0.093972338s INFO prepare_target{force=false package_id=aoc-1b v0.1.0 (/home/tabby/rust-projects/aoc-1b) target="aoc-1b"}: cargo::core::compiler::fingerprint: stale: changed "/home/tabby/rust-projects/aoc-1b/src/main.rs"
|
||||
0.093979886s INFO prepare_target{force=false package_id=aoc-1b v0.1.0 (/home/tabby/rust-projects/aoc-1b) target="aoc-1b"}: cargo::core::compiler::fingerprint: (vs) "/home/tabby/rust-projects/aoc-1b/target/debug/.fingerprint/aoc-1b-eb026e6914e22efc/dep-test-bin-aoc-1b"
|
||||
0.093984734s INFO prepare_target{force=false package_id=aoc-1b v0.1.0 (/home/tabby/rust-projects/aoc-1b) target="aoc-1b"}: cargo::core::compiler::fingerprint: FileTime { seconds: 1764631767, nanos: 802321084 } < FileTime { seconds: 1764631785, nanos: 866379579 }
|
||||
0.094021386s INFO prepare_target{force=false package_id=aoc-1b v0.1.0 (/home/tabby/rust-projects/aoc-1b) target="aoc-1b"}: cargo::core::compiler::fingerprint: fingerprint dirty for aoc-1b v0.1.0 (/home/tabby/rust-projects/aoc-1b)/Check { test: true }/TargetInner { name: "aoc-1b", doc: true, ..: with_path("/home/tabby/rust-projects/aoc-1b/src/main.rs", Edition2024) }
|
||||
0.094030812s INFO prepare_target{force=false package_id=aoc-1b v0.1.0 (/home/tabby/rust-projects/aoc-1b) target="aoc-1b"}: cargo::core::compiler::fingerprint: dirty: FsStatusOutdated(StaleItem(ChangedFile { reference: "/home/tabby/rust-projects/aoc-1b/target/debug/.fingerprint/aoc-1b-eb026e6914e22efc/dep-test-bin-aoc-1b", reference_mtime: FileTime { seconds: 1764631767, nanos: 802321084 }, stale: "/home/tabby/rust-projects/aoc-1b/src/main.rs", stale_mtime: FileTime { seconds: 1764631785, nanos: 866379579 } }))
|
||||
Checking aoc-1b v0.1.0 (/home/tabby/rust-projects/aoc-1b)
|
||||
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.15s
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@
|
|||
{"reason":"compiler-artifact","package_id":"registry+https://github.com/rust-lang/crates.io-index#regex-syntax@0.8.8","manifest_path":"/home/tabby/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/regex-syntax-0.8.8/Cargo.toml","target":{"kind":["lib"],"crate_types":["lib"],"name":"regex_syntax","src_path":"/home/tabby/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/regex-syntax-0.8.8/src/lib.rs","edition":"2021","doc":true,"doctest":true,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":["default","std","unicode","unicode-age","unicode-bool","unicode-case","unicode-gencat","unicode-perl","unicode-script","unicode-segment"],"filenames":["/home/tabby/rust-projects/aoc-1b/target/debug/deps/libregex_syntax-3c02c2619e360563.rmeta"],"executable":null,"fresh":true}
|
||||
{"reason":"compiler-artifact","package_id":"registry+https://github.com/rust-lang/crates.io-index#regex-automata@0.4.13","manifest_path":"/home/tabby/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/regex-automata-0.4.13/Cargo.toml","target":{"kind":["lib"],"crate_types":["lib"],"name":"regex_automata","src_path":"/home/tabby/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/regex-automata-0.4.13/src/lib.rs","edition":"2021","doc":true,"doctest":true,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":["alloc","dfa-onepass","hybrid","meta","nfa-backtrack","nfa-pikevm","nfa-thompson","perf-inline","perf-literal","perf-literal-multisubstring","perf-literal-substring","std","syntax","unicode","unicode-age","unicode-bool","unicode-case","unicode-gencat","unicode-perl","unicode-script","unicode-segment","unicode-word-boundary"],"filenames":["/home/tabby/rust-projects/aoc-1b/target/debug/deps/libregex_automata-cd902cf7bb778459.rmeta"],"executable":null,"fresh":true}
|
||||
{"reason":"compiler-artifact","package_id":"registry+https://github.com/rust-lang/crates.io-index#regex@1.12.2","manifest_path":"/home/tabby/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/regex-1.12.2/Cargo.toml","target":{"kind":["lib"],"crate_types":["lib"],"name":"regex","src_path":"/home/tabby/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/regex-1.12.2/src/lib.rs","edition":"2021","doc":true,"doctest":true,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":["default","perf","perf-backtrack","perf-cache","perf-dfa","perf-inline","perf-literal","perf-onepass","std","unicode","unicode-age","unicode-bool","unicode-case","unicode-gencat","unicode-perl","unicode-script","unicode-segment"],"filenames":["/home/tabby/rust-projects/aoc-1b/target/debug/deps/libregex-58ac3800c315fb75.rmeta"],"executable":null,"fresh":true}
|
||||
{"reason":"compiler-artifact","package_id":"path+file:///home/tabby/rust-projects/aoc-1b#0.1.0","manifest_path":"/home/tabby/rust-projects/aoc-1b/Cargo.toml","target":{"kind":["bin"],"crate_types":["bin"],"name":"aoc-1b","src_path":"/home/tabby/rust-projects/aoc-1b/src/main.rs","edition":"2024","doc":true,"doctest":false,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":true},"features":[],"filenames":["/home/tabby/rust-projects/aoc-1b/target/debug/deps/libaoc_1b-eb026e6914e22efc.rmeta"],"executable":null,"fresh":true}
|
||||
{"reason":"compiler-artifact","package_id":"path+file:///home/tabby/rust-projects/aoc-1b#0.1.0","manifest_path":"/home/tabby/rust-projects/aoc-1b/Cargo.toml","target":{"kind":["bin"],"crate_types":["bin"],"name":"aoc-1b","src_path":"/home/tabby/rust-projects/aoc-1b/src/main.rs","edition":"2024","doc":true,"doctest":false,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/tabby/rust-projects/aoc-1b/target/debug/deps/libaoc_1b-917b8d9d404e499a.rmeta"],"executable":null,"fresh":true}
|
||||
{"reason":"compiler-artifact","package_id":"path+file:///home/tabby/rust-projects/aoc-1b#0.1.0","manifest_path":"/home/tabby/rust-projects/aoc-1b/Cargo.toml","target":{"kind":["bin"],"crate_types":["bin"],"name":"aoc-1b","src_path":"/home/tabby/rust-projects/aoc-1b/src/main.rs","edition":"2024","doc":true,"doctest":false,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/tabby/rust-projects/aoc-1b/target/debug/deps/libaoc_1b-917b8d9d404e499a.rmeta"],"executable":null,"fresh":false}
|
||||
{"reason":"compiler-artifact","package_id":"path+file:///home/tabby/rust-projects/aoc-1b#0.1.0","manifest_path":"/home/tabby/rust-projects/aoc-1b/Cargo.toml","target":{"kind":["bin"],"crate_types":["bin"],"name":"aoc-1b","src_path":"/home/tabby/rust-projects/aoc-1b/src/main.rs","edition":"2024","doc":true,"doctest":false,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":true},"features":[],"filenames":["/home/tabby/rust-projects/aoc-1b/target/debug/deps/libaoc_1b-eb026e6914e22efc.rmeta"],"executable":null,"fresh":false}
|
||||
{"reason":"build-finished","success":true}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue