-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP157.java
More file actions
50 lines (48 loc) · 1.36 KB
/
P157.java
File metadata and controls
50 lines (48 loc) · 1.36 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
39
40
41
42
43
44
45
46
47
48
49
50
package buclesSimples;
import java.util.Scanner;
//accepted
public class P157 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int dia, mes, contador;
int casos = sc.nextInt();
for (int i = 0; i < casos; i++) {
dia = sc.nextInt();
mes = sc.nextInt();
contador = 0;
while (dia != 31 || mes != 12) {
dia++;
contador++;
switch (mes) {
case 2:
if (dia>28){
dia=1;
mes++;
}
break;
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
if (dia>31){
dia=1;
mes++;
}
break;
case 4:
case 6:
case 9:
case 11:
if (dia>30){
dia=1;
mes++;
}
break;
}
}
System.out.println(contador);
}
}
}