From 86b552ba70fd18a6e450c89315469d1a7b5e640f Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Sun, 19 Nov 2017 02:22:46 +0100 Subject: Problema 373 resuelto. --- AceptaElReto/src/problemas/Problema373.java | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 AceptaElReto/src/problemas/Problema373.java diff --git a/AceptaElReto/src/problemas/Problema373.java b/AceptaElReto/src/problemas/Problema373.java new file mode 100644 index 0000000..9d52272 --- /dev/null +++ b/AceptaElReto/src/problemas/Problema373.java @@ -0,0 +1,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);*/ + } +} -- cgit v1.2.1