Last active
December 25, 2020 07:19
-
-
Save Riey/2343cbb5823cc0231b4fcb5f91b46d5c to your computer and use it in GitHub Desktop.
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
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