結果

問題 No.2109 Special Week
ユーザー shojin_proshojin_pro
提出日時 2022-10-28 22:06:20
言語 Java
(openjdk 23)
結果
AC  
実行時間 246 ms / 2,000 ms
コード長 795 bytes
コンパイル時間 2,817 ms
コンパイル使用メモリ 78,528 KB
実行使用メモリ 43,908 KB
最終ジャッジ日時 2024-07-06 01:15:44
合計ジャッジ時間 13,364 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.text.SimpleDateFormat;
import java.sql.Timestamp;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String start = String.format("%02d", sc.nextInt())+String.format("%02d", sc.nextInt());
        int K = sc.nextInt();
        SimpleDateFormat sdf = new SimpleDateFormat("MMdd");
        Calendar cal = Calendar.getInstance();
        cal.setTime(sdf.parse(start));
        HashSet<Character> set = new HashSet<>();
        for(int i = 0; i < 7; i++){
            for(char c : sdf.format(cal.getTime()).toCharArray()){
                set.add(c);
            }
            cal.add(Calendar.DATE, 1);
        }
        System.out.println(set.size() >= K ? "Yes" : "No");
    }
}
0