結果
| 問題 |
No.188 HAPPY DAY
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-09 16:16:58 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 1,369 bytes |
| コンパイル時間 | 16,773 ms |
| コンパイル使用メモリ | 379,112 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-07 14:36:12 |
| 合計ジャッジ時間 | 13,744 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 |
ソースコード
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
struct Input {}
fn read_input(_cin_lock: &mut StdinLock) -> Input {
Input {}
}
fn solve(_input: Input) {
let ans = (1..12 + 1)
.map(|m| {
let max_d = match m {
2 => 28,
4 | 6 | 9 | 11 => 30,
_ => 31,
};
(1..max_d + 1)
.map(|d| {
let x_sum = d
.to_string()
.chars()
.into_iter()
.map(|s| s.to_string().parse::<i64>().ok().unwrap())
.sum::<i64>();
if x_sum == m {
1
} else {
0
}
})
.sum::<i64>()
})
.sum::<i64>();
println!("{}", ans)
}
fn _next_token<T: FromStr>(cin_lock: &mut StdinLock) -> T {
cin_lock
.by_ref()
.bytes()
.map(|c| c.unwrap() as char)
.skip_while(|c| c.is_whitespace())
.take_while(|c| !c.is_whitespace())
.collect::<String>()
.parse::<T>()
.ok()
.unwrap()
}
fn main() {
let cin = stdin();
let mut cin_lock = cin.lock();
let input = read_input(&mut cin_lock);
solve(input);
}