結果

問題 No.2561 みんな大好きmod 998
ユーザー viral8viral8
提出日時 2023-12-02 14:49:02
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 777 bytes
コンパイル時間 2,975 ms
コンパイル使用メモリ 77,288 KB
実行使用メモリ 55,148 KB
最終ジャッジ日時 2023-12-02 14:49:12
合計ジャッジ時間 6,771 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
54,116 KB
testcase_01 AC 61 ms
54,996 KB
testcase_02 AC 47 ms
54,112 KB
testcase_03 AC 88 ms
55,008 KB
testcase_04 AC 102 ms
55,012 KB
testcase_05 AC 94 ms
55,004 KB
testcase_06 AC 92 ms
55,132 KB
testcase_07 AC 48 ms
54,132 KB
testcase_08 AC 49 ms
54,124 KB
testcase_09 AC 50 ms
54,116 KB
testcase_10 AC 47 ms
54,120 KB
testcase_11 WA -
testcase_12 AC 50 ms
54,124 KB
testcase_13 AC 48 ms
54,112 KB
testcase_14 AC 49 ms
54,128 KB
testcase_15 WA -
testcase_16 AC 56 ms
54,132 KB
testcase_17 AC 50 ms
54,116 KB
testcase_18 AC 50 ms
54,116 KB
testcase_19 WA -
testcase_20 AC 48 ms
54,120 KB
testcase_21 AC 46 ms
54,104 KB
testcase_22 AC 48 ms
54,120 KB
testcase_23 AC 49 ms
54,128 KB
testcase_24 AC 47 ms
54,140 KB
testcase_25 AC 48 ms
54,120 KB
testcase_26 WA -
testcase_27 AC 91 ms
55,004 KB
testcase_28 AC 72 ms
55,028 KB
testcase_29 AC 64 ms
55,004 KB
testcase_30 AC 73 ms
55,028 KB
testcase_31 AC 75 ms
55,012 KB
testcase_32 AC 67 ms
55,012 KB
testcase_33 AC 70 ms
55,008 KB
testcase_34 AC 92 ms
55,012 KB
testcase_35 AC 67 ms
55,028 KB
testcase_36 AC 63 ms
55,024 KB
testcase_37 AC 63 ms
55,036 KB
testcase_38 AC 70 ms
55,020 KB
testcase_39 AC 70 ms
55,004 KB
testcase_40 AC 67 ms
55,012 KB
testcase_41 AC 67 ms
55,020 KB
testcase_42 AC 71 ms
55,012 KB
testcase_43 AC 61 ms
55,016 KB
testcase_44 AC 64 ms
54,996 KB
testcase_45 AC 87 ms
55,016 KB
testcase_46 AC 68 ms
55,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
class Main{
	private static final BufferedReader br =
		new BufferedReader(new InputStreamReader(System.in));
	private static final PrintWriter out =
		new PrintWriter(System.out);
	public static void main(String[] args)throws IOException{

		String[] str = br.readLine().split(" ");
		int N = Integer.parseInt(str[0]);
		int K = Integer.parseInt(str[1]);
		str = br.readLine().split(" ");
		int[] A = new int[N];
		for(int i=0;i<N;i++)
			A[i] = Integer.parseInt(str[i]);
		out.println(dfs(0,0,K,A)%998);

		br.close();
		out.close();
	}
	private static int dfs(int now,long sum,int K,int[] A){
		if(K==0)
			return sum%99824353<=sum%998?1:0;
		if(now==A.length)
			return 0;
		return dfs(now+1,sum,K,A)+dfs(now+1,sum+A[now],K-1,A);
	}
}
0