blob: 9d52272ed8c651b03df2c39d4b7a8dc43d87a387 (
plain)
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
|
package problemas;
/*
* Cubos visibles
*
* cara * 6 - arista * 12 + esquinas
* o
* cubo(n) - cubo(n-2)
*/
public class Problema373 {
static java.util.Scanner in;
public static void main(String args[]) {
in = new java.util.Scanner(System.in);
int numCasos = in.nextInt();
for (int i = 0; i < numCasos; i++) {
System.out.println(casoDePrueba(in.nextLong()));
}
}
public static String casoDePrueba(long arista) {
if ( arista == 1 ) {
return String.valueOf(1);
}
return String.valueOf(arista*arista*arista - (arista-2)*(arista-2)*(arista-2));
/*long cara = arista*arista;
int esquinas = 4;
return String.valueOf(cara*6 - arista*6 + esquinas);*/
}
}
|