-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathP413.java
47 lines (27 loc) · 839 Bytes
/
P413.java
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
39
40
41
42
43
44
45
46
47
package aceptaelreto;
import java.util.*;
public class P413 {
static Scanner s;
static void cas(){
int blanc,negre,total;
blanc = s.nextInt();
negre = s.nextInt();
total = blanc*negre;
if (total % 2 == 1) {
blanc = total / 2 + 1;
negre = total / 2;
} else {
negre = total / 2;
blanc = total /2;
}
System.out.printf("%d %d\n",blanc,negre);
}
public static void main(String[] args) {
s = new Scanner(System.in);
int n;
n = s.nextInt();
for (int i = 0; i < n; i++){
cas();
}
}
}