結果
| 問題 | No.188 HAPPY DAY | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-10-13 17:15:49 | 
| 言語 | Rust (1.83.0 + proconio) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 1,000 ms | 
| コード長 | 792 bytes | 
| コンパイル時間 | 14,063 ms | 
| コンパイル使用メモリ | 390,056 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-12-16 02:32:15 | 
| 合計ジャッジ時間 | 14,380 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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)]` 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);
}
            
            
            
        