結果
問題 | No.188 HAPPY DAY |
ユーザー |
|
提出日時 | 2019-10-12 08:56:49 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 1,117 bytes |
コンパイル時間 | 12,943 ms |
コンパイル使用メモリ | 384,100 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 23:42:37 |
合計ジャッジ時間 | 12,436 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 |
コンパイルメッセージ
warning: variable does not need to be mutable --> src/main.rs:2:9 | 2 | let mut month_max = 12; | ----^^^^^^^^^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default warning: variable does not need to be mutable --> src/main.rs:3:9 | 3 | let mut date_left_max = 3; | ----^^^^^^^^^^^^^ | | | help: remove this `mut` warning: variable does not need to be mutable --> src/main.rs:4:9 | 4 | let mut date_right_max = 9; | ----^^^^^^^^^^^^^^ | | | help: remove this `mut`
ソースコード
fn main() {let mut month_max = 12;let mut date_left_max = 3;let mut date_right_max = 9;let mut happy_day_count = 0;for month in 1..month_max+1 {for date_left in 0..date_left_max+1 {for date_right in 0..date_right_max+1 {// 0日はあり得ないif date_left == 0 && date_right == 0 {continue;}// 2月は28日までif month == 2 && (date_left*10 + date_right) > 28 {break;}// 4, 6, 9, 11は30日までif (month == 4 || month == 6 || month == 9 || month == 11) && (date_left*10 + date_right) > 30 {break;}// 31日より後の日付はあり得ないif date_left == 3 && date_right > 1 {break;}if month == (date_left + date_right) {happy_day_count += 1;}}}}println!("{}", happy_day_count);}