結果

問題 No.2109 Special Week
ユーザー myu2myu2
提出日時 2023-02-26 19:45:13
言語 Rust
(1.77.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 3,760 bytes
コンパイル時間 1,887 ms
コンパイル使用メモリ 157,416 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-12 10:01:32
合計ジャッジ時間 3,022 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 1 ms
4,352 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 1 ms
4,356 KB
testcase_08 AC 1 ms
4,352 KB
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,356 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 1 ms
4,368 KB
testcase_17 AC 1 ms
4,352 KB
testcase_18 AC 1 ms
4,352 KB
testcase_19 AC 1 ms
4,352 KB
testcase_20 AC 1 ms
4,356 KB
testcase_21 AC 1 ms
4,352 KB
testcase_22 AC 1 ms
4,356 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 1 ms
4,348 KB
testcase_25 AC 1 ms
4,352 KB
testcase_26 AC 1 ms
4,352 KB
testcase_27 AC 1 ms
4,348 KB
testcase_28 AC 1 ms
4,348 KB
testcase_29 AC 1 ms
4,352 KB
testcase_30 AC 1 ms
4,348 KB
testcase_31 AC 1 ms
4,372 KB
testcase_32 AC 1 ms
4,348 KB
testcase_33 AC 1 ms
4,352 KB
testcase_34 AC 1 ms
4,352 KB
testcase_35 AC 1 ms
4,352 KB
testcase_36 AC 1 ms
4,356 KB
testcase_37 AC 1 ms
4,352 KB
testcase_38 AC 1 ms
4,356 KB
testcase_39 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(unused_imports, unused_macros)]
use myu2::*;
use std::cmp::*;
use std::collections::*;
use std::io::Read;

fn main() {
    input! {
        m: usize, d: usize, k: usize
    }

    let mut days = vec![];
    for i in 0..7 {
        days.push(f(m, d, i));
    }

    let mut set = HashSet::new();
    for i in 0..7 {
        for c in days[i].chars() {
            set.insert(c);
        }
    }

    let ans = if set.len() >= k { "Yes" } else { "No" };
    println!("{}", ans);
}

// lib
fn f(mut m: usize, mut d: usize, x: usize) -> String {
    d += x;
    if d > 31 && m == 12 {
        m = 1;
        d -= 31;
    } else if d > 31 && (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10) {
        m += 1;
        d -= 31;
    } else if d > 30 && (m == 4 || m == 6 || m == 9 || m == 11) {
        m += 1;
        d -= 30;
    } else if d > 28 && m == 2 {
        m += 1;
        d -= 28;
    }
    return format!("{:02}{:02}", m, d);
}

// util
#[macro_use]
pub mod myu2 {
    // input
    #[macro_export]
    macro_rules! input { ($($r:tt)*) => { let mut bytes = std::io::Read::bytes(std::io::BufReader::new(std::io::stdin())); let mut next = move |is_word: bool| -> String{if is_word { bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() } else { bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c| c == &'\n').take_while(|c| c != &'\n').collect() } }; input_inner!{next, $($r)*}; }; }
    #[macro_export]
    macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, static $var:ident : $t:tt $($rest:tt)*) => { $var = read_value!($next, $t); input_inner!{$next $($rest)*} }; ($next:expr, mut $var:ident : $t:tt $($rest:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($rest)*} }; ($next:expr, $var:ident : $t:tt $($rest:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($rest)*} }; }
    #[macro_export]
    macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; all ]) => { { let mut str = $next(false); str.split_whitespace().map(|it| it.parse::<$t>().unwrap()).collect::<Vec<_>>() } }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len as usize).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, lines) => { { let mut vec = Vec::new(); let mut str = $next(false); while str != "" { vec.push(str); str = $next(false); } vec } }; ($next:expr, line) => { $next(false) }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next(true).parse::<$t>().expect("Parse error") }; }
    // min, max
    #[macro_export]
    macro_rules! min { ($a:expr $(,)*) => {{ $a }}; ($a:expr, $b:expr $(,)*) => {{ std::cmp::min($a, $b) }}; ($a:expr, $($rest:expr),+ $(,)*) => {{ std::cmp::min($a, min!($($rest),+)) }}; }
    #[macro_export]
    macro_rules! max { ($a:expr $(,)*) => {{ $a }}; ($a:expr, $b:expr $(,)*) => {{ std::cmp::max($a, $b) }}; ($a:expr, $($rest:expr),+ $(,)*) => {{ std::cmp::max($a, max!($($rest),+)) }}; }
    // chmin, chmax
    #[macro_export]
    macro_rules! chmin { ($base:expr, $($cmps:expr),+ $(,)*) => {{ let cmp_min = min!($($cmps),+); if $base > cmp_min { $base = cmp_min; true } else { false } }}; }
    #[macro_export]
    macro_rules! chmax { ($base:expr, $($cmps:expr),+ $(,)*) => {{ let cmp_max = max!($($cmps),+); if $base < cmp_max { $base = cmp_max; true } else { false } }}; }
    // std::collections
    #[macro_export]
    macro_rules! hashmap { ($( $key: expr => $val: expr ),*) => {{ let mut map = ::std::collections::HashMap::new(); $( map.insert($key, $val); )* map } } }
}
0