-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP739.java
More file actions
23 lines (19 loc) · 837 Bytes
/
P739.java
File metadata and controls
23 lines (19 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package buclesSimples;
import java.util.Scanner;
//accepted
public class P739 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 1; i <= n; i++) {
int anchoPared = sc.nextInt();
int altoPared = sc.nextInt();
int anchoAzulejo = sc.nextInt();
int altoAzulejo = sc.nextInt();
int horizontal, vertical;
horizontal= ((anchoPared / anchoAzulejo)+(anchoPared % anchoAzulejo==0? 0:1))*((altoPared / altoAzulejo)+(altoPared % altoAzulejo==0? 0:1));
vertical= ((anchoPared/altoAzulejo)+(anchoPared % altoAzulejo==0? 0:1))*((altoPared/anchoAzulejo)+(altoPared % anchoAzulejo==0? 0:1));
System.out.println(Math.min(horizontal, vertical));
}
}
}