Skip to content

Instantly share code, notes, and snippets.

@Riey
Last active December 25, 2020 07:19
Show Gist options
  • Save Riey/2343cbb5823cc0231b4fcb5f91b46d5c to your computer and use it in GitHub Desktop.
Save Riey/2343cbb5823cc0231b4fcb5f91b46d5c to your computer and use it in GitHub Desktop.
use time::{Date, Weekday};
fn main() {
let n = std::env::args().nth(1).unwrap().parse().unwrap();
let current_year = 2020;
let mut native = 0;
let mut bridge = 0;
for i in 0..n {
let date = Date::try_from_ymd(current_year + i, 12, 25).unwrap();
print!("{}", date);
match date.weekday() {
Weekday::Monday | Weekday::Friday => {
println!(": 황금");
native += 1;
}
Weekday::Tuesday | Weekday::Thursday => {
println!(": 징검다리");
bridge += 1;
}
_ => {
println!();
}
}
}
println!("합계 황금: {}, 징검다리: {}", native, bridge);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment