-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcardgame.java
More file actions
38 lines (30 loc) · 1.14 KB
/
cardgame.java
File metadata and controls
38 lines (30 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class cardgame {
public static void calc() throws IOException{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int input = Integer.parseInt(reader.readLine());
int i=0;
while(i<input){
String[] nums = reader.readLine().split(" ");
long m = Long.parseLong(nums[0]);
long n = Long.parseLong(nums[1]);
long q = Long.parseLong(reader.readLine());
long j=0;
while(j<q){
long size = Long.parseLong(reader.readLine());
if(size<=m && size<=m){
double cards = Math.ceil((double)m/size) * Math.ceil((double)n/size);
System.out.println((long)cards%1000000007);}
else
{System.out.println(0);}
j++;
}
i++;
}
}
public static void main(String[] args) throws IOException{
calc();
}
}