Liberar recursos
This commit is contained in:
1 parent
7d1787561d
commit
f9afb9f095
4 files changed
+47
-33
No files matched your search
@@ -15,7 +15,7 @@ public class P164_AreaRectangulo {
|
||||
bx = sc.nextInt();
|
||||
by = sc.nextInt();
|
||||
|
||||
// Omitir casos de prueba
|
||||
// Salir ante un caso invalido
|
||||
if(ax > bx || ay > by) break;
|
||||
|
||||
l1 = bx - ax;
|
||||
@@ -23,5 +23,6 @@ public class P164_AreaRectangulo {
|
||||
area = l1 * l2;
|
||||
System.out.println(area);
|
||||
}
|
||||
sc.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ public class P260_AlanSmithee {
|
||||
System.out.println("NO");
|
||||
}
|
||||
}
|
||||
sc.close();
|
||||
}
|
||||
|
||||
private static boolean isAnagram(String s1, String s2) {
|
||||
@@ -39,4 +40,4 @@ public class P260_AlanSmithee {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,5 +14,6 @@ public class P481_Ajedrez {
|
||||
char letra = (char) ((8 - h) + (int) ('a'));
|
||||
System.out.printf("%c%d\n", letra, v);
|
||||
} while (true);
|
||||
sc.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
+40
-29
@@ -1,32 +1,43 @@
|
||||
// Determinar si tengo más ropa de verano o invierno (o ambos)
|
||||
// V I I I I V. -> Invierno | V V V V I. -> Verano | VVIIAA -> Empate
|
||||
|
||||
void main() {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
int i = 0;
|
||||
char c = '0';
|
||||
while (true) {
|
||||
c = sc.next().charAt(0);
|
||||
switch (c) {
|
||||
case 'V':
|
||||
i++;
|
||||
break;
|
||||
case 'I':
|
||||
i--;
|
||||
break;
|
||||
case '.':
|
||||
if (i < 0)
|
||||
System.out.println("Invierno");
|
||||
else if (i > 0)
|
||||
System.out.println("Verano");
|
||||
else
|
||||
System.out.println("Empate");
|
||||
i = 0;
|
||||
break;
|
||||
case 'A':
|
||||
break;
|
||||
default:
|
||||
System.out.println("Carácter invalido");
|
||||
}
|
||||
}
|
||||
}
|
||||
import java.util.*;
|
||||
|
||||
public class P605_Armario {
|
||||
public static void main(String[] args) {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
int balance = 0;
|
||||
boolean hayRopa = false;
|
||||
while (true) {
|
||||
char c = sc.next().charAt(0);
|
||||
if (c == '.') {
|
||||
if (!hayRopa) {
|
||||
break;
|
||||
}
|
||||
if (balance < 0)
|
||||
System.out.println("INVIERNO");
|
||||
else if (balance > 0)
|
||||
System.out.println("VERANO");
|
||||
else
|
||||
System.out.println("EMPATE");
|
||||
balance = 0;
|
||||
hayRopa = false;
|
||||
continue;
|
||||
}
|
||||
switch (c) {
|
||||
case 'V':
|
||||
balance++;
|
||||
break;
|
||||
case 'I':
|
||||
balance--;
|
||||
break;
|
||||
case 'A':
|
||||
break;
|
||||
default:
|
||||
System.out.println("Carácter invalido");
|
||||
}
|
||||
hayRopa = true;
|
||||
}
|
||||
sc.close();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user