結果
| 問題 |
No.2561 みんな大好きmod 998
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-12-02 14:49:02 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 777 bytes |
| コンパイル時間 | 3,142 ms |
| コンパイル使用メモリ | 77,304 KB |
| 実行使用メモリ | 51,456 KB |
| 最終ジャッジ日時 | 2024-09-26 17:28:25 |
| 合計ジャッジ時間 | 7,540 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 WA * 4 |
ソースコード
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);
}
}