-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e8600c
commit a841cc5
Showing
6 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
fn brute_force(time: i64, distance: i64) -> u64 { | ||
(0..time).filter(|&t| t * (time - t) > distance).count() as u64 | ||
} | ||
|
||
fn part1(inputs: impl Iterator<Item = (i64, i64)>) -> u64 { | ||
inputs | ||
.map(|(time, distance)| brute_force(time, distance)) | ||
.product::<u64>() | ||
} | ||
|
||
fn main() { | ||
let input_one = &[(61, 430), (67, 1036), (75, 1307), (71, 1150)]; | ||
let input_two = (61677571, 430103613071150); | ||
|
||
println!("Part 1: {}", part1(input_one.iter().copied())); | ||
println!("Part 2: {}", brute_force(input_two.0, input_two.1)); | ||
} |
This file was deleted.
Oops, something went wrong.