結果
| 問題 | No.188 HAPPY DAY |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-10-13 17:15:49 |
| 言語 | Rust (1.99.0 + proconio + num + itertools + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 0 ms / 1,000 ms |
| + 812µs | |
| コード長 | 792 bytes |
| 記録 | |
| コンパイル時間 | 571 ms |
| コンパイル使用メモリ | 180,176 KB |
| 実行使用メモリ | 9,848 KB |
| 最終ジャッジ日時 | 2026-10-04 07:44:48 |
| 合計ジャッジ時間 | 1,992 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 |
コンパイルメッセージ
warning: function `read_stdin` is never used
--> src/main.rs:3:4
|
3 | fn read_stdin() -> Vec<String> {
| ^^^^^^^^^^
|
= note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
ソースコード
use std::io::{self, Read};
fn read_stdin() -> Vec<String> {
let mut buffer = String::new();
io::stdin().read_to_string(&mut buffer).ok();
buffer.trim().split('\n').map(|s| s.to_string()).collect()
}
fn main() {
let days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
let result = (1..days.len() + 1).zip(days.iter()).fold(0, |sum, (i, day)| {
sum + (1..*day + 1).fold(0, |acc, d| {
if d >= 10 {
let a = d / 10;
let b = d % 10;
if i == a + b {
acc + 1
} else {
acc
}
} else if i == d {
acc + 1
} else {
acc
}
})
});
println!("{}", result);
}