diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2017-11-19 02:22:46 +0100 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2017-11-19 02:22:46 +0100 |
commit | 86b552ba70fd18a6e450c89315469d1a7b5e640f (patch) | |
tree | 53221e7c04d498296c62429e3bf61ac2652e21a6 | |
parent | da754a61fb874ea246c94ec44485d3634b3b2dd6 (diff) | |
download | AceptaElReto-86b552ba70fd18a6e450c89315469d1a7b5e640f.tar.gz AceptaElReto-86b552ba70fd18a6e450c89315469d1a7b5e640f.zip |
Problema 373 resuelto.
-rw-r--r-- | AceptaElReto/src/problemas/Problema373.java | 33 |
1 files changed, 33 insertions, 0 deletions
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);*/
+ }
+}
|