結果
| 問題 | No.188 HAPPY DAY |
| コンテスト | |
| ユーザー |
mottodora
|
| 提出日時 | 2016-10-15 00:33:31 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 644 bytes |
| コンパイル時間 | 13,784 ms |
| コンパイル使用メモリ | 402,416 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-31 01:08:15 |
| 合計ジャッジ時間 | 14,643 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 |
ソースコード
fn check(month:i32, day:i32) -> i32 {
let x = day % 10 + day / 10;
match x {
a if a == month => return 1,
_ => return 0,
}
}
fn counthappyday(month:i32, day:i32) -> i32 {
let mut count = 0;
for i in 1..day+1 {
count += check(month, i)
}
return count
}
fn happyday() -> i32 {
let mut count = 0;
for i in 1..13 {
match i {
2 => count += counthappyday(i, 28),
4 | 6 | 9 | 11 => count += counthappyday(i, 30),
_ => count += counthappyday(i, 31),
}
}
return count
}
fn main() {
println!("{}", happyday());
}
mottodora