F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

The classic problem

Time Limit: 8000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 93    Accepted Submission(s): 12


Problem Description
there are $N$ items,which has values from 0 to $N-1$,find a subset of the items(you can choose nothing),you need to make the sum of the subset
$S\equiv 0(mod~M)$

what's more,we make the rule that $K$ values $(a_1,a_2..a_K)$cannot be chosen.

please output the number of ways module 998244353
 

Input
the first line contains a number $T$,means the number of the test cases.

next,for each test case,the first line contains three numbers,$N,M,K$.

next line contains $K$ distinct numbers,$a_1,a_2..a_K$,means the numbers cannot be chosen.

$T\le 200,N\le 10^9,m\le 2048,K\le 4000$,$M$ is the Power of 2.

Only for 4 test cases there are $m>200$.
 

Output
$T$ lines,for each test case,output the answer.
 

Sample Input
1 6 8 1 2
 

Sample Output
6 six ways: $0+1+3+4=8$ $1+3+4=8$ $0+3+5=8$ $3+5=8$ $0$ choose nothing($S=0$)
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 17:43:09, Gzip enabled