結果

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

ソースコード

diff #


import static java.lang.System.err;
import java.util.Calendar;
import java.util.HashSet;

public class Main {
	public static void main(String[] args) {
		java.io.PrintWriter out = new java.io.PrintWriter(System.out);
		new Main(out);
		out.flush();
		err.flush();
	}

	public Main(java.io.PrintWriter out) {
		try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			int M = sc.nextInt(), D = sc.nextInt(), K = sc.nextInt();
			HashSet<Character> set = new HashSet<>();
			for (int i = 0;i < 7;++ i) {
				Calendar calendar = Calendar.getInstance();
				calendar.set(2022, M - 1, D);
				calendar.add(Calendar.DAY_OF_MONTH, i);
				String date = String.format("%02d/%02d", calendar.get(Calendar.MONTH) + 1, calendar.get(Calendar.DAY_OF_MONTH));
				err.println(date);
				for (char d = '0';d <= '9';++ d) if (date.contains(d + "")) set.add(d);
			}
			out.println(set.size() >= K ? "Yes" : "No");
		}
	}
}
0