Compare commits
4
Commits
58030ec54a
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de0900d1d2 | ||
|
|
d689f80fbc | ||
|
|
f9afb9f095 | ||
|
|
7d1787561d |
No files matched your search
@@ -26,7 +26,7 @@ public class P112_RadaresDeTramo {
|
|||||||
if (velocidad > velPermitida){
|
if (velocidad > velPermitida){
|
||||||
// indicará "MULTA" si se superó esa velocidad en menos de un 20% de la velocidad máxima permitida,
|
// indicará "MULTA" si se superó esa velocidad en menos de un 20% de la velocidad máxima permitida,
|
||||||
// y "PUNTOS" si la velocidad fue superada en un 20% o más de esa velocidad;
|
// y "PUNTOS" si la velocidad fue superada en un 20% o más de esa velocidad;
|
||||||
double rangoMulta = velPermitida * 20 / 100; // Rango que decide si te multan o te quitan puntos
|
double rangoMulta = velPermitida * 0.20; // Rango que decide si te multan o te quitan puntos
|
||||||
if(velocidad < velPermitida + rangoMulta){
|
if(velocidad < velPermitida + rangoMulta){
|
||||||
System.out.println("MULTA");
|
System.out.println("MULTA");
|
||||||
} else {
|
} else {
|
||||||
@@ -36,5 +36,6 @@ public class P112_RadaresDeTramo {
|
|||||||
System.out.println("OK");
|
System.out.println("OK");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sc.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ public class P164_AreaRectangulo {
|
|||||||
bx = sc.nextInt();
|
bx = sc.nextInt();
|
||||||
by = sc.nextInt();
|
by = sc.nextInt();
|
||||||
|
|
||||||
// Omitir casos de prueba
|
// Salir ante un caso invalido
|
||||||
if(ax > bx || ay > by) break;
|
if(ax > bx || ay > by) break;
|
||||||
|
|
||||||
l1 = bx - ax;
|
l1 = bx - ax;
|
||||||
@@ -23,5 +23,6 @@ public class P164_AreaRectangulo {
|
|||||||
area = l1 * l2;
|
area = l1 * l2;
|
||||||
System.out.println(area);
|
System.out.println(area);
|
||||||
}
|
}
|
||||||
|
sc.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class P221_Cine {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner sc = new Scanner(System.in);
|
||||||
|
|
||||||
|
// Número de casos de prueba
|
||||||
|
int casos = sc.nextInt();
|
||||||
|
for (int caso = 0; caso < casos; caso++) {
|
||||||
|
boolean impar = false; // Marca cuando empiezen los impares
|
||||||
|
boolean valido = true;
|
||||||
|
int contador = 0; // Comienzo de las butacas impares
|
||||||
|
// Número de personas esperando
|
||||||
|
int gente = sc.nextInt();
|
||||||
|
for (int persona = 0; persona < gente; persona++) {
|
||||||
|
int butaca = sc.nextInt();
|
||||||
|
if ((butaca & 1) == 0) { // es par
|
||||||
|
if (!impar) {
|
||||||
|
contador++;
|
||||||
|
} else {
|
||||||
|
valido = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
impar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (valido) {
|
||||||
|
System.out.printf("SI %d\n", contador);
|
||||||
|
} else
|
||||||
|
System.out.println("NO");
|
||||||
|
}
|
||||||
|
sc.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@ public class P260_AlanSmithee {
|
|||||||
System.out.println("NO");
|
System.out.println("NO");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sc.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isAnagram(String s1, String s2) {
|
private static boolean isAnagram(String s1, String s2) {
|
||||||
@@ -39,4 +40,4 @@ public class P260_AlanSmithee {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10
-5
@@ -7,12 +7,17 @@ public class P481_Ajedrez {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Scanner sc = new Scanner(System.in);
|
Scanner sc = new Scanner(System.in);
|
||||||
int h = 0, v = 0;
|
int h = 0, v = 0;
|
||||||
|
boolean detener = false;
|
||||||
do {
|
do {
|
||||||
h = sc.nextInt();
|
h = sc.nextInt();
|
||||||
v = sc.nextInt();
|
v = sc.nextInt();
|
||||||
if (h == 0 && v == 0) break;
|
if (h == 0 && v == 0) {
|
||||||
char letra = (char) ((8 - h) + (int) ('a'));
|
detener = true;
|
||||||
System.out.printf("%c%d\n", letra, v);
|
} else {
|
||||||
} while (true);
|
char letra = (char) ((8 - h) + (int) ('a'));
|
||||||
|
System.out.printf("%c%d\n", letra, v);
|
||||||
|
}
|
||||||
|
} while (!detener);
|
||||||
|
sc.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+40
-29
@@ -1,32 +1,43 @@
|
|||||||
// Determinar si tengo más ropa de verano o invierno (o ambos)
|
// 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
|
// V I I I I V. -> Invierno | V V V V I. -> Verano | VVIIAA -> Empate
|
||||||
|
|
||||||
void main() {
|
import java.util.*;
|
||||||
Scanner sc = new Scanner(System.in);
|
|
||||||
int i = 0;
|
public class P605_Armario {
|
||||||
char c = '0';
|
public static void main(String[] args) {
|
||||||
while (true) {
|
Scanner sc = new Scanner(System.in);
|
||||||
c = sc.next().charAt(0);
|
int balance = 0;
|
||||||
switch (c) {
|
boolean hayRopa = false;
|
||||||
case 'V':
|
while (true) {
|
||||||
i++;
|
char c = sc.next().charAt(0);
|
||||||
break;
|
if (c == '.') {
|
||||||
case 'I':
|
if (!hayRopa) {
|
||||||
i--;
|
break;
|
||||||
break;
|
}
|
||||||
case '.':
|
if (balance < 0)
|
||||||
if (i < 0)
|
System.out.println("INVIERNO");
|
||||||
System.out.println("Invierno");
|
else if (balance > 0)
|
||||||
else if (i > 0)
|
System.out.println("VERANO");
|
||||||
System.out.println("Verano");
|
else
|
||||||
else
|
System.out.println("EMPATE");
|
||||||
System.out.println("Empate");
|
balance = 0;
|
||||||
i = 0;
|
hayRopa = false;
|
||||||
break;
|
continue;
|
||||||
case 'A':
|
}
|
||||||
break;
|
switch (c) {
|
||||||
default:
|
case 'V':
|
||||||
System.out.println("Carácter invalido");
|
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