結果
問題 | No.2109 Special Week |
ユーザー |
![]() |
提出日時 | 2022-10-28 21:55:06 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 224 ms / 2,000 ms |
コード長 | 821 bytes |
コンパイル時間 | 3,839 ms |
コンパイル使用メモリ | 91,460 KB |
実行使用メモリ | 58,332 KB |
最終ジャッジ日時 | 2024-07-06 01:01:36 |
合計ジャッジ時間 | 12,764 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
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 = "2022"+String.format("%02d", sc.nextInt())+String.format("%02d", sc.nextInt()); int K = sc.nextInt(); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); 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()).substring(4,8).toCharArray()){ set.add(c); } cal.add(Calendar.DATE, 1); } System.out.println(set.size() >= K ? "Yes" : "No"); } }