結果

問題 No.2109 Special Week
ユーザー YGBKYGBK
提出日時 2022-11-20 02:26:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 220 ms / 2,000 ms
コード長 1,455 bytes
コンパイル時間 4,454 ms
コンパイル使用メモリ 87,412 KB
実行使用メモリ 58,404 KB
最終ジャッジ日時 2023-10-21 05:10:25
合計ジャッジ時間 14,292 ms
ジャッジサーバーID
(参考情報)
judge9 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 181 ms
58,056 KB
testcase_01 AC 187 ms
57,616 KB
testcase_02 AC 186 ms
58,044 KB
testcase_03 AC 205 ms
57,636 KB
testcase_04 AC 194 ms
58,052 KB
testcase_05 AC 194 ms
57,776 KB
testcase_06 AC 193 ms
58,124 KB
testcase_07 AC 191 ms
57,772 KB
testcase_08 AC 195 ms
58,256 KB
testcase_09 AC 193 ms
58,020 KB
testcase_10 AC 206 ms
58,244 KB
testcase_11 AC 201 ms
58,112 KB
testcase_12 AC 199 ms
57,672 KB
testcase_13 AC 216 ms
58,136 KB
testcase_14 AC 220 ms
58,072 KB
testcase_15 AC 194 ms
58,404 KB
testcase_16 AC 212 ms
58,168 KB
testcase_17 AC 194 ms
58,144 KB
testcase_18 AC 189 ms
58,004 KB
testcase_19 AC 180 ms
58,132 KB
testcase_20 AC 196 ms
58,136 KB
testcase_21 AC 190 ms
58,080 KB
testcase_22 AC 189 ms
58,176 KB
testcase_23 AC 195 ms
57,984 KB
testcase_24 AC 185 ms
58,072 KB
testcase_25 AC 183 ms
58,052 KB
testcase_26 AC 194 ms
57,880 KB
testcase_27 AC 182 ms
58,068 KB
testcase_28 AC 198 ms
58,000 KB
testcase_29 AC 207 ms
58,196 KB
testcase_30 AC 199 ms
58,056 KB
testcase_31 AC 199 ms
58,100 KB
testcase_32 AC 197 ms
58,396 KB
testcase_33 AC 192 ms
57,836 KB
testcase_34 AC 184 ms
58,140 KB
testcase_35 AC 181 ms
58,064 KB
testcase_36 AC 199 ms
57,784 KB
testcase_37 AC 198 ms
58,056 KB
testcase_38 AC 205 ms
58,168 KB
testcase_39 AC 195 ms
58,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws NumberFormatException, ParseException {
		
		Scanner sc =  new Scanner(System.in);
		
		
		//入力
		String m = sc.next();
		String d = sc.next();
		int k = Integer.parseInt(sc.next());
		List<Boolean> list = new ArrayList<>();
		for(int i=0;i<10;i++) {
			list.add(false);
		}
		sc.close();
		
		List<String> week = new ArrayList<>();
		
		//日付生成
		Calendar c = Calendar.getInstance();
		
		
		SimpleDateFormat df = new SimpleDateFormat("MM/dd");
		SimpleDateFormat tmp = new SimpleDateFormat("yyyy-MM-dd");
		Date  date=  tmp.parse(LocalDate.of(2022, Integer.parseInt(m),Integer.parseInt(d)).toString());
		c.setTime(date);
		week.add(df.format(c.getTime()));
		for(int i = 1;i <= 6;i++) {
			c.add(Calendar.DAY_OF_MONTH, 1);
			week.add(df.format(c.getTime()));
		}
		
		for(String day : week) {
			for(int i=0;i<day.length();i++) {
				String s=  String.valueOf(day.charAt(i));
				if("/".equals(s)) continue;
				int num = Integer.parseInt(s);
				if(list.get(num)) continue;
				list.set(num, true);
			}
		}
		
		int sum = 0;
		for(int i=0;i<list.size();i++) {
			if(list.get(i)) sum++;
		}
		
		System.out.println( (sum >= k)? "Yes" : "No");
	}
}
0