<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-19962453</id><updated>2024-08-30T02:58:00.532-07:00</updated><category term="ACM ICPC"/><category term="coj"/><category term="java"/><category term="programming-challenges"/><category term="LightOJ"/><category term="Buap"/><category term="Uva es"/><category term="codeforces"/><category term="C++"/><category term="Nintendo"/><category term="Traducciones"/><category term="Video Juegos"/><category term="lab-131"/><title type='text'>BreakDark</title><subtitle type='html'>Blog dedicado a la publicación de artículos, programas propios, traducciones de Roms de Nes, super Nes y mas, y alguno que otro artículo sobre tecnologia.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>105</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-19962453.post-4513556615003916454</id><published>2018-01-22T17:37:00.003-08:00</published><updated>2018-01-22T17:37:42.031-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="Uva es"/><title type='text'>Solución al problema: 10783 - Odd Sum con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;https://uva.onlinejudge.org/index.php?option=com_onlinejudge&amp;Itemid=8&amp;category=19&amp;page=show_problem&amp;problem=1724&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.BitSet;
import java.util.Scanner;

/**
 * Soluci&amp;oacute;n a 10783 - Odd Sum [https://uva.onlinejudge.org/]
 *
 * @author BreakDark (Jhonny Monrroy)
 * @version 1.0 24 nov. de 2017
 */
// Accepted!!! xD
public class Main {
 public static void main(String[] args) {
  Scanner Lee = new Scanner(System.in);
  int t, a, b, i, j, sum;
  BitSet impares = new BitSet(101);
  for (i = 1; i &lt;= 100; i += 2)
   impares.set(i);

  // AQUI INICIA EL PROGRAMA
  t = Lee.nextInt();
  for (i = 1; i &lt;= t; i++) {
   a = Lee.nextInt();
   b = Lee.nextInt();
   sum = 0;
   for (j = a; j &lt;= b; j++) {
    if (impares.get(j))
     sum += j;
   }
   System.out.println(&quot;Case &quot; + i + &quot;: &quot; + sum);
  }
  Lee.close();
 }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/4513556615003916454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/4513556615003916454' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/4513556615003916454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/4513556615003916454'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2018/01/solucion-al-problema-10783-odd-sum-con.html' title='Solución al problema: 10783 - Odd Sum con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-5083991403073284854</id><published>2018-01-22T17:31:00.002-08:00</published><updated>2018-01-22T17:31:47.075-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="Uva es"/><title type='text'>Solución al problema: 488 - Triangle Wave con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;https://uva.onlinejudge.org/index.php?option=com_onlinejudge&amp;Itemid=8&amp;category=6&amp;page=show_problem&amp;problem=429&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;

/**
 * 488 - Triangle Wave [http://uva.onlinejudge.org]
 * 
 * @author BreakDark
 * @version 2.0 beta
 */
// ACEPTADO!!! xD
public class Main {
    public static void main(String[] args) {
        Scanner Lee; // para leer los datos de entrada
        int numcasos; // para el numero de casos
        byte amplitud; // para la amplitud
        int frecuencia; // frecuencia
        int i; // para los bucles
        // vector de ondas
        String[] vec = {&quot;&quot;, &quot;1&quot;, &quot;1\n22\n1&quot;, &quot;1\n22\n333\n22\n1&quot;, &quot;1\n22\n333\n4444\n333\n22\n1&quot;, &quot;1\n22\n333\n4444\n55555\n4444\n333\n22\n1&quot;,
                &quot;1\n22\n333\n4444\n55555\n666666\n55555\n4444\n333\n22\n1&quot;,
                &quot;1\n22\n333\n4444\n55555\n666666\n7777777\n666666\n55555\n4444\n333\n22\n1&quot;,
                &quot;1\n22\n333\n4444\n55555\n666666\n7777777\n88888888\n7777777\n666666\n55555\n4444\n333\n22\n1&quot;,
                &quot;1\n22\n333\n4444\n55555\n666666\n7777777\n88888888\n999999999\n88888888\n7777777\n666666\n55555\n4444\n333\n22\n1&quot;};

        // AQUI INICIA EL PROGRAMA
        Lee = new Scanner(System.in);
        numcasos = Lee.nextInt();
        while(numcasos-- &gt; 0){
            amplitud = Lee.nextByte();
            frecuencia = Lee.nextInt();
            for(i = 0; i &lt; frecuencia; i++){
                System.out.println(vec[amplitud]);
                if(i &lt; frecuencia - 1 || numcasos &gt; 0)
                    System.out.println();
            }
        }
    }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/5083991403073284854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/5083991403073284854' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/5083991403073284854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/5083991403073284854'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2018/01/solucion-al-problema-488-triangle-wave.html' title='Solución al problema: 488 - Triangle Wave con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-6951420877499518038</id><published>2018-01-22T17:20:00.001-08:00</published><updated>2018-01-22T17:22:39.197-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="Uva es"/><title type='text'>Solución al problema: 106 - Fermat vs Pythagoras con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;https://uva.onlinejudge.org/index.php?option=com_onlinejudge&amp;Itemid=8&amp;category=3&amp;page=show_problem&amp;problem=42&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.BitSet;
import java.util.Scanner;

/**
 * 106 - Fermat vs. Pythagoras [http://uva.onlinejudge.org]
 * 
 * @author BreakDark
 * @version 3.0 beta
 */
// ACEPTADO!!! xD
public class Main {
 public static void main(String[] args) {
  Scanner Lee; // Para leer los datos de entrada
  int N; // para el N a leer

  // AQUI INICIA EL PROGRAMA!!!
  Lee = new Scanner(System.in);
  while(Lee.hasNext()){
   N = Lee.nextInt();
   calcula(N);
  }
 }
 /**
  * Procedimiento que realiza todo el trabajo
  * 
  * @param N
  *            el numero a procesar
  */
 private static void calcula(int N) {
  int cont = 0;
  int numUsados = 0;
  int r, s, i, x, y, z;
  BitSet numeros = new BitSet(N + 1);

  for(r = 2; r * r &lt;= N; r++)
   for(s = 1; s &lt; r &amp;&amp; r * r + s * s &lt;= N; s++){
    x = r * r - s * s;
    y = 2 * r * s;
    z = r * r + s * s;
    if(mcd(x, y) == 1){
     cont++;
     for(i = 1; z * i &lt;= N; i++){
      if(!numeros.get(x * i)){
       numUsados++;
       numeros.set(x * i);
      }
      // para y
      if(!numeros.get(y * i)){
       numUsados++;
       numeros.set(y * i);
      }
      // para z
      if(!numeros.get(z * i)){
       numUsados++;
       numeros.set(z * i);
      }
     }
    }
   }
  System.out.println(cont + &quot; &quot; + (N - numUsados));
 }
 /**
  * Funcion que encuentra el MCD de dos enteros basado en el slgoritmo de
  * euclides
  * 
  * @param a
  *            entero a evaluar el MCD
  * @param b
  *            entero a evaluar el MCD
  * @return el MCD de a y b
  */
 private static int mcd(int a, int b) {
  int r;
  if(b &gt; a){
   r = a;
   a = b;
   b = r;
  }
  r = b;
  while(b &gt; 0){
   r = a % b;
   a = b;
   b = r;
  }
  return a;
 }
}
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/6951420877499518038/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/6951420877499518038' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/6951420877499518038'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/6951420877499518038'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2018/01/solucion-al-problema-106-fermat-vs.html' title='Solución al problema: 106 - Fermat vs Pythagoras con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-5892295530917468655</id><published>2017-02-25T05:13:00.001-08:00</published><updated>2017-02-25T05:13:20.439-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="Buap"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><title type='text'>Solución al problema: 10004 - Islas [http://acm.cs.buap.mx] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://acm.cs.buap.mx/problemas/10004.html&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;
import java.util.Stack;

/**
 * Solución al problema: 10004 - Islas [http://acm.cs.buap.mx]
 * 
 * @author BreakDark (Jhonny Monrroy)
 * @version 1.0b 18 feb. 2017
 */
// ACETTADO!!! xD
public class Main {
 public static void main(String[] args) {
  Scanner Lee; // para leer los datos de entrada
  int n; // dimension del mapa
  char[][] mapa;
  int i; // para los bucles

  // AQUI INICIA EL PROGRAMA
  Lee = new Scanner(System.in);
  do {
   n = Lee.nextInt();
   if (n &gt; 0) {
    mapa = new char[n][n];
    for (i = 0; i &lt; n; i++) {
     mapa[i] = Lee.next().toCharArray();
    }
    System.out.println(obtenerSolucion(n, mapa));
   }
  } while (Lee.hasNext() &amp;&amp; n != 0);
  Lee.close();
 }

 /**
  * Metodo que obtiene la solucion del problema
  * 
  * @param n
  *            Dimension del mapa
  * @param mapa
  *            Matriz que representa el mapa
  * @return Un String que representa la solucion
  */
 public static String obtenerSolucion(int n, char[][] mapa) {
  int[][] mp = new int[n][n]; // mapa de numeros
  // int[] dimIslas = new int[n * n]; // dimension de las islas
  int numIsla = 0;
  int i, j; // para los bucles

  // recorremos la matriz del mapa
  for (i = 0; i &lt; n; i++) {
   for (j = 0; j &lt; n; j++) {
    if (mapa[i][j] != &#39;m&#39;) {
     // pintamos la isla
     if (mp[i][j] == 0) {
      // si no esta pintado ya
      Stack&lt;Integer&gt; pila = new Stack&lt;Integer&gt;();
      pila.push(i); // introcucimos la primera coordenada
      pila.push(j);
      while (!pila.isEmpty()) {
       int ind_j = pila.pop();
       int ind_i = pila.pop();
       // System.out.println(ind_j + &quot;,&quot; + ind_i);
       // buscamos los alrededores
       // coordenada NorOeste
       if (ind_i &gt; 0 &amp;&amp; ind_j &gt; 0 &amp;&amp; mapa[ind_i - 1][ind_j - 1] == &#39;t&#39;
         &amp;&amp; mp[ind_i - 1][ind_j - 1] == 0) {
        pila.push(ind_i - 1);
        pila.push(ind_j - 1);
       }
       // coordenada Norte
       if (ind_i &gt; 0 &amp;&amp; mapa[ind_i - 1][ind_j] == &#39;t&#39; &amp;&amp; mp[ind_i - 1][ind_j] == 0) {
        pila.push(ind_i - 1);
        pila.push(ind_j);
       }
       // coordenada NorEste
       if (ind_i &gt; 0 &amp;&amp; ind_j + 1 &lt; n &amp;&amp; mapa[ind_i - 1][ind_j + 1] == &#39;t&#39;
         &amp;&amp; mp[ind_i - 1][ind_j + 1] == 0) {
        pila.push(ind_i - 1);
        pila.push(ind_j + 1);
       }
       // Oeste
       if (ind_j &gt; 0 &amp;&amp; mapa[ind_i][ind_j - 1] == &#39;t&#39; &amp;&amp; mp[ind_i][ind_j - 1] == 0) {
        pila.push(ind_i);
        pila.push(ind_j - 1);
       }
       // coordenada Este
       if (ind_j + 1 &lt; n &amp;&amp; mapa[ind_i][ind_j + 1] == &#39;t&#39; &amp;&amp; mp[ind_i][ind_j + 1] == 0) {
        pila.push(ind_i);
        pila.push(ind_j + 1);
       }
       // coordenada SurOeste
       if (ind_i + 1 &lt; n &amp;&amp; ind_j &gt; 0 &amp;&amp; mapa[ind_i + 1][ind_j - 1] == &#39;t&#39;
         &amp;&amp; mp[ind_i + 1][ind_j - 1] == 0) {
        pila.push(ind_i + 1);
        pila.push(ind_j - 1);
       }
       // coordenada Sur
       if (ind_i + 1 &lt; n &amp;&amp; mapa[ind_i + 1][ind_j] == &#39;t&#39; &amp;&amp; mp[ind_i + 1][ind_j] == 0) {
        pila.push(ind_i + 1);
        pila.push(ind_j);
       }
       // coordenada SurEste
       if (ind_i + 1 &lt; n &amp;&amp; ind_j + 1 &lt; n &amp;&amp; mapa[ind_i + 1][ind_j + 1] == &#39;t&#39;
         &amp;&amp; mp[ind_i + 1][ind_j + 1] == 0) {
        pila.push(ind_i + 1);
        pila.push(ind_j + 1);
       }
       mp[ind_i][ind_j] = numIsla + 1;
      }
      numIsla++;
     }
    }
   }
  }

  // si no hay islas o solo hay una
  if (numIsla == 0)
   return &quot;No hay islas&quot;;
  if (numIsla == 1)
   return &quot;Solo hay una isla&quot;;

  // buscamos el menor y la mayor dimension
  int min = Integer.MAX_VALUE, max = Integer.MIN_VALUE;
  for (int isla = 1; isla &lt;= numIsla; isla++) {
   int cont = 0;
   for (i = 0; i &lt; n; i++)
    for (j = 0; j &lt; n; j++)
     if (mp[i][j] &gt; 0 &amp;&amp; mp[i][j] == isla)
      cont++;
   if (cont &gt; 0 &amp;&amp; cont &lt; min)
    min = cont;
   if (cont &gt; max)
    max = cont;
  }
  return min + &quot; &quot; + max;
 }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/5892295530917468655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/5892295530917468655' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/5892295530917468655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/5892295530917468655'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2017/02/solucion-al-problema-10004-islas.html' title='Solución al problema: 10004 - Islas [http://acm.cs.buap.mx] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-5407815912682761922</id><published>2017-02-25T05:07:00.000-08:00</published><updated>2017-02-25T05:14:23.628-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="Buap"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><title type='text'>Solución al problema: 10003 - Burrito Amarrado [http://acm.cs.buap.mx] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://acm.cs.buap.mx/problemas/10003.html&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;

/**
 * Solución al problema: 10003 - Burrito Amarrado [http://acm.cs.buap.mx]
 */

/**
 * @author BreakDark (Jhonny Monrroy)
 * @version 2.0 b 18 feb. 2017
 */
// ACEPTADO!!! xD
public class Main {
 public static void main(String[] args) {
  Scanner Lee; // para los datos de entrada
  int r, n; /// radio y numero de intentos

  // AQUI INICIA EL PROGRAMA
  Lee = new Scanner(System.in);
  do {
   r = Lee.nextInt();
   n = Lee.nextInt();
   if (r != 0 &amp;&amp; n != 0)
    System.out.println(obtenerSolucion(r, n));
  } while (Lee.hasNext() &amp;&amp; r != 0 &amp;&amp; n != 0);
  Lee.close();
 }

 /**
  * Metodo que obtiene la solucion del problema
  * 
  * @param r
  *            Radio del corral
  * @param n
  *            Numero de intentos
  * @return Un String que representa la distancia del burrito al poste
  */
 public static String obtenerSolucion(int r, int n) {
  double x = 0, y = 0; // coordenadas del burrito
  byte dir = 0; // 0=norte, 1=este, 2=sur, 3=oeste

  while (n-- &gt; 0) {
   switch (dir) {
   case 0: // norte
    y = (y + Math.sqrt(r * r - x * x)) / 2;
    break;
   case 1: // este
    x = (x + Math.sqrt(r * r - y * y)) / 2;
    break;
   case 2: // sur
    y = (y - Math.sqrt(r * r - x * x)) / 2;
    break;
   default: // oeste
    x = (x - Math.sqrt(r * r - y * y)) / 2;
    dir = -1; // para volver a empezar desde el principio
    break;
   }
   dir++;
  }
  // mostramos el resultado
  return String.format(&quot;%.2f&quot;, Math.sqrt(x * x + y * y)).replace(&#39;,&#39;, &#39;.&#39;);
 }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/5407815912682761922/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/5407815912682761922' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/5407815912682761922'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/5407815912682761922'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2017/02/solucion-al-problema-10003-burrito.html' title='Solución al problema: 10003 - Burrito Amarrado [http://acm.cs.buap.mx] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-6046486672800382784</id><published>2017-02-25T05:02:00.000-08:00</published><updated>2017-02-25T05:13:58.558-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="Buap"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><title type='text'>Soluci&amp;oacute;n al problema: 10002 - El inspector [http://acm.cs.buap.mx] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://acm.cs.buap.mx/problemas/10002.html&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.BitSet;
import java.util.PriorityQueue;
import java.util.Scanner;

/**
 * Soluci&amp;oacute;n al problema: 10002 - El inspector [http://acm.cs.buap.mx]
 * 
 * @author BreakDark
 * @version 1.0b 17 feb. 2017
 */
// ACEPTADO!!! xD
public class Main {
 public static void main(String[] args) {
  Scanner Lee; // para leer los datos de entrada
  int n; // numero de casos de prueba
  String p; // nombre de la poblacion
  String s; // informacion de los cultivos

  // AQUI INICIA EL PROGRAMA
  Lee = new Scanner(System.in);
  n = Integer.parseInt(Lee.nextLine());
  while (n-- &gt; 0) {
   p = Lee.nextLine();
   s = Lee.nextLine();
   System.out.print(procesar(p, s));
  }
  Lee.close();
 }

 /**
  * Metodo que resueleve el problema
  * 
  * @param p
  *            Nombre de la poblacion
  * @param s
  *            Informacion de los cultivos
  */
 static String procesar(String p, String s) {
  String resp = &quot;&quot;;
  // contamos los cultivos
  int dim = &#39;z&#39; - &#39;a&#39; + 1, i;
  BitSet tipoCultivos = new BitSet(dim - 1);
  char letra;
  int d = 0; // desconocidos
  int[] cultivos = new int[dim];
  for (i = 0; i &lt; s.length(); i++) {
   letra = s.charAt(i);
   if (letra != &#39;*&#39;) {
    tipoCultivos.set(letra - &#39;a&#39;);
    cultivos[letra - &#39;a&#39;]++;
   } else
    d++;
  }
  resp += &quot;POBLACION: &quot; + p + &quot;\n&quot;;
  resp += &quot;TIPOS DE CULTIVOS: &quot; + tipoCultivos.cardinality() + &quot;\n&quot;;
  resp += &quot;DESCONOCIDOS: &quot; + d + &quot;\n&quot;;
  resp += &quot;CANTIDADES:&quot; + &quot;\n&quot;;
  // mostramos los conteos de los cultivos
  PriorityQueue&lt;CultivoValor&gt; cola = new PriorityQueue&lt;CultivoValor&gt;();
  for (i = 0; i &lt; dim; i++) {
   // adicionamos los valores a una cola de prioridad
   if (cultivos[i] &gt; 0)
    cola.add(new CultivoValor((char) (&#39;a&#39; + i), cultivos[i]));
   // resp += (char) (&#39;a&#39; + i) + &quot; - &quot; + cultivos[i] + &quot;\n&quot;;
  }
  // mostramos la cola
  while (!cola.isEmpty()) {
   CultivoValor cv = cola.poll();
   resp += cv.cult + &quot; - &quot; + cv.val + &quot;\n&quot;;
  }
  return resp;
 }
}

class CultivoValor implements Comparable&lt;CultivoValor&gt; {
 char cult;
 int val;

 public CultivoValor(char c, int v) {
  this.cult = c;
  this.val = v;
 }

 @Override
 public int compareTo(CultivoValor X) {
  if (X.val - this.val == 0)
   return this.cult - X.cult;
  return X.val - this.val;
 }
}
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/6046486672800382784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/6046486672800382784' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/6046486672800382784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/6046486672800382784'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2017/02/soluci-al-problema-10002-el-inspector.html' title='Soluci&amp;oacute;n al problema: 10002 - El inspector [http://acm.cs.buap.mx] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-9004792582867024517</id><published>2016-09-15T20:54:00.002-07:00</published><updated>2016-09-15T20:54:44.542-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="LightOJ"/><title type='text'>Solucion al Problema: 1354 – IP Checking [http://lightoj.com/] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://lightoj.com/volume_showproblem.php?problem=1354 &quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;

/**
 * Solucion al Problema: 1354 – IP Checking [http://lightoj.com/]
 * 
 * @author BreakDark (Jhonny Monrroy)
 * @version 1.0 14 ago. 2016
 */
// Accepted!!! xD
public class Main {
 public static void main(String[] args) {
  Scanner Lee; // para leer los datos de entrada
  int T; // numero de casos de prueba
  String ipDecimal, ipBinario;

  // AQUI INICIA EL PROGRAMA
  Lee = new Scanner(System.in);
  T = Lee.nextInt();
  for (int i = 1; i &lt;= T; i++) {
   ipDecimal = Lee.next();
   ipBinario = Lee.next();
   String aux = Short.parseShort(ipBinario.substring(0, 8), 2) + &quot;.&quot;;
   aux += Short.parseShort(ipBinario.substring(9, 17), 2) + &quot;.&quot;;
   aux += Short.parseShort(ipBinario.substring(18, 26), 2) + &quot;.&quot;;
   aux += Short.parseShort(ipBinario.substring(27), 2);
   System.out.println(&quot;Case &quot; + i + &quot;: &quot; + (ipDecimal.equals(aux) ? &quot;Yes&quot; : &quot;No&quot;));
  }
  Lee.close();
 }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/9004792582867024517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/9004792582867024517' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/9004792582867024517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/9004792582867024517'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/09/solucion-al-problema-1354-ip-checking.html' title='Solucion al Problema: 1354 – IP Checking [http://lightoj.com/] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-1959807733757210646</id><published>2016-09-15T20:45:00.004-07:00</published><updated>2016-09-16T09:07:09.526-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="LightOJ"/><title type='text'>Solucion al Problema: 1293 - Document Analyzer [http://lightoj.com/] con C++</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://lightoj.com/volume_showproblem.php?problem=1293&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:cpp&quot;&gt;//============================================================================
// Name        : 1293.cpp
// Author      : BreakDark (Jhonny Monrroy) basado en la solucion publicada en [http://www.cnblogs.com/njczy2010/p/4337078.html]
// Version     : 3.0 16/09/2016
// Copyright   : (Solucion obtenida de [http://www.cnblogs.com/njczy2010/p/4337078.html])
// Description : Solucion al Problema: 1293 - Document Analyzer [http://lightoj.com/]
//============================================================================

// Accepted!!! xD

#include &amp;lt;iostream&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string&amp;gt;
#include &amp;lt;cstring&amp;gt;
#include &amp;lt;sstream&amp;gt;
#include &amp;lt;map&amp;gt;

using namespace std;

int T; // para el numero de casos de prueba
int t; // indice

/**
 * Metodo procesarPalabra: reemplaza los caracteres que no son letras por
 * espacios
 *
 * @author BreakDark (Jhonny Monrroy)
 * @version 1.0 20 ago. 2016
 * @param palabra
 *            Cadena a procesar
 * @return Retorna la cadena ya proceesda
 */
string procesarPalabra(string palabra) {
 string nuevaLinea = &quot;&quot;;
 char letra;
 for (int i = 0; i &amp;lt; palabra.length(); i++) {
  letra = palabra[i];
  if (letra &amp;gt;= &#39;a&#39; &amp;amp;&amp;amp; letra &amp;lt;= &#39;z&#39;) {
   nuevaLinea += letra;
  } else {
   nuevaLinea += &#39; &#39;;
  }
 }
 return nuevaLinea;
}

/**
 * Metodo obtenerRangoMenor: Metodo que busca el rango menor para este
 * problema
 *
 * @author BreakDark (Jhonny Monrroy)
 * @version 1.0 20 ago. 2016
 * @param vecPal
 *            Vector de palabras
 * @param numPal
 *            Numero de palabras del vector
 * @param hashPal
 *            HashMap de palabras no iguales
 */
void obtenerRangoMenor(string vecPal[], int numPal, map&amp;lt;string, int&amp;gt; hashPal) {
 int p = -1;
 int q = numPal + 1;
 int posible_p, posible_q;
 int cont = 0; // contador de palabras encontradas
 posible_p = 0;
 posible_q = 0;
 while (posible_p &amp;lt; numPal) {
  for (; posible_q &amp;lt; numPal; posible_q++) {
   hashPal[vecPal[posible_q]]++;
   if (hashPal[vecPal[posible_q]] == 1)
    cont++;
   if (cont == hashPal.size()) {
    for (; posible_p &amp;lt;= posible_q; posible_p++) {
     if (hashPal[vecPal[posible_p]] == 1) {
      if (posible_q - posible_p &amp;lt; q - p) {
       p = posible_p;
       q = posible_q;
      } else if (posible_q - posible_p == q - p) {
       if (posible_p &amp;lt; p) {
        p = posible_p;
        q = posible_q;
       }
      }
      hashPal[vecPal[posible_p]]--;
      cont--;
      posible_p++;
      posible_q++;
      break;
     }
     hashPal[vecPal[posible_p]]--;
    }
    break;
   }
  }
  if (posible_q == numPal)
   break;
 }
 printf(&quot;Case %d: %d %d\n&quot;, t, (p + 1), (q + 1));
}

int main() {
 //int T; // para el numero de casos de prueba
 string palabra; // para cada palabra
 char linea[102]; // para la linea que se lea
 string linea_s;

 string palabras[50000]; // vector de palabras
 int numPal; // para el numero de palabras a almacenar
 map&amp;lt;string, int&amp;gt; hashPalabras; // conjunto de palabras no repetidas

 // AQUI INICIA EL PROGRAMA
 scanf(&quot;%d&quot;, &amp;amp;T);
 for (t = 1; t &amp;lt;= T; t++) {
  numPal = 0; // vaciamos el vector
  hashPalabras.clear();
  while (scanf(&quot;%s&quot;, linea) != EOF &amp;amp;&amp;amp; strcmp(linea, &quot;END&quot;) != 0) {
   char nuevaLinea[102] = &quot;&quot;;
   char letra;
   for (int i = 0; i &amp;lt; strlen(linea); i++) {
    letra = linea[i];
    if (letra &amp;gt;= &#39;a&#39; &amp;amp;&amp;amp; letra &amp;lt;= &#39;z&#39;) {
     nuevaLinea[strlen(nuevaLinea)] = letra;
    } else {
     strcat(nuevaLinea, &quot; &quot;);
    }
   }
   strcpy(linea, nuevaLinea);
   //cout&amp;lt;&amp;lt;linea&amp;lt;&amp;lt;endl;
   char *vecPalabras;
   vecPalabras = strtok(linea, &quot; &quot;);
   while (vecPalabras != NULL) {
    //printf(&quot;%s\n&quot;, vecPalabras);
    palabras[numPal] = vecPalabras;
    stringstream ss;
    ss &amp;lt;&amp;lt; palabras[numPal];
    ss &amp;gt;&amp;gt; linea_s;

    hashPalabras[linea_s] = 0; // seleccionamos palabras distintas
    numPal++;
    vecPalabras = strtok(NULL, &quot; &quot;);
   }
  }
  obtenerRangoMenor(palabras, numPal, hashPalabras);
 }
 return 0;
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/1959807733757210646/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/1959807733757210646' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/1959807733757210646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/1959807733757210646'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/09/solucion-al-problema-1293-document.html' title='Solucion al Problema: 1293 - Document Analyzer [http://lightoj.com/] con C++'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-4217626382618213535</id><published>2016-09-15T20:39:00.005-07:00</published><updated>2016-09-15T20:39:58.772-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="LightOJ"/><title type='text'>Solucion al Problema: 1109 - False Ordering [http://lightoj.com/] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://lightoj.com/volume_showproblem.php?problem=1109&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;

/**
 * Solucion al Problema: 1109 - False Ordering [http://lightoj.com/]
 * 
 * @author BreakDark (Jhonny Monrroy)
 * @version 1.0 13 ago. 2016
 */
// Accepted!!! xD
public class Main {
 public static void main(String[] args) {
  Scanner Lee; // para leer los datos de entrada
  int t; // numero de casos
  int n; // numero a evaluar
  int vecDiv[]; // vector para almacenar cantidad de veces que es divisor
                // cada indice
  int vecNum[]; // numero de los valores que seran ordenados
  int limite = 1001; // para el limite de las operaciones

  // AQUI INICIA EL PROGRAMA
  Lee = new Scanner(System.in);
  // generamos el vector de num de divisores
  vecDiv = new int[limite + 1];
  vecNum = new int[limite + 1];
  for (int i = 1; i &lt;= limite; i++) {
   for (int j = i; j &lt;= limite; j += i) {
    vecDiv[j]++;
   }
   vecNum[i] = i;
  }

  // ordenamos los valores por el metodo burbuja adecauado al problema
  for (int i = 1; i &lt; limite - 1; i++) {
   for (int j = i + 1; j &lt; limite; j++) {
    int x = vecNum[j];
    int y = vecNum[i];
    if (vecDiv[x] &lt; vecDiv[y] || (vecDiv[x] == vecDiv[y] &amp;&amp; x &gt; y)) {
     int aux = vecNum[i];
     vecNum[i] = vecNum[j];
     vecNum[j] = aux;
    }
   }
  }

  // leemos los datos
  t = Lee.nextInt();
  for (int i = 1; i &lt;= t; i++) {
   n = Lee.nextInt();
   System.out.println(&quot;Case &quot; + i + &quot;: &quot; + vecNum[n]);
  }
  Lee.close();
 }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/4217626382618213535/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/4217626382618213535' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/4217626382618213535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/4217626382618213535'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/09/solucion-al-problema-1109-false.html' title='Solucion al Problema: 1109 - False Ordering [http://lightoj.com/] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-6133376427657936399</id><published>2016-09-15T20:37:00.004-07:00</published><updated>2016-09-15T20:37:52.604-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="LightOJ"/><title type='text'>Solucion al Problema: 1072 – Calm Down [http://lightoj.com/] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://lightoj.com/volume_showproblem.php?problem=1072&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;

/**
 * Solucion al Problema: 1072 – Calm Down [http://lightoj.com/]
 * 
 * @author BreakDark (Jhonny Monrroy)
 * @version 1.0 14 ago. 2016
 */
// Accepted!!! xD
public class Main {
 public static void main(String[] args) {
  Scanner Lee; // para leer los datos de entrada
  int T; // numero de casos de prueba
  double R; // para el radio
  int n; // numero re balas esperado
  double r; // radio buscado

  // AQUI INICIA EL PROGRAMA
  Lee = new Scanner(System.in);
  T = Lee.nextInt();
  for (int i = 1; i &lt;= T; i++) {
   R = Double.parseDouble(Lee.next());
   n = Lee.nextInt();
   double angulo = 2 * Math.PI / n;
   double senoAngulo = Math.sin(angulo / 2);
   r = R * senoAngulo / (1 + senoAngulo);
   if (r == (int) r) {
    System.out.println(String.format(&quot;Case %d: %d&quot;, i, (int) r));
   } else {
    System.out.println(String.format(&quot;Case %d: %.10f&quot;, i, r).replace(&#39;,&#39;, &#39;.&#39;));
   }
  }
  Lee.close();
 }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/6133376427657936399/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/6133376427657936399' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/6133376427657936399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/6133376427657936399'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/09/solucion-al-problema-1072-calm-down.html' title='Solucion al Problema: 1072 – Calm Down [http://lightoj.com/] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-1066400769445971881</id><published>2016-09-15T20:35:00.002-07:00</published><updated>2016-09-15T20:35:31.429-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="LightOJ"/><title type='text'>Solucion al Problema: 1043 - Triangle Partitioning [http://lightoj.com/] con java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://lightoj.com/volume_showproblem.php?problem=1043&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;

/**
 * Solucion al Problema: 1043 - Triangle Partitioning [http://lightoj.com/]
 * 
 * @author BreakDark (Jhonny Monrroy)
 * @version 1.0 beta 08/10/2013
 */
// ACEPTADO!!! xD
public class Main {
 public static void main(String[] args) {
  Scanner Lee; // para leer los datos de entrada
  byte T, caso; // para los casos de entrada
  double AB, AC, BC; // para los lados del triangulo
  double r; // para el radio de las areas
  double Area, Area1, Area2; // para las areas
  double SenoDeAlpha; // Seno de Alfa
  double h, h1, h2; // la altura del triangulo inicial
  double AD; // longitud superior del trapecio, y la longitud buscada

  // AQUI INICIA EL PROGRAMA
  Lee = new Scanner(System.in);
  T = Lee.nextByte();
  for (caso = 1; caso &lt;= T; caso++) {
   // leemos la informacion
   AB = Lee.nextDouble();
   AC = Lee.nextDouble();
   BC = Lee.nextDouble();
   r = Lee.nextDouble();
   // obtenemos el area del traingulo
   Area = areaDelTriangulo(AB, AC, BC);
   h = 2 * Area / BC;
   Area2 = Area / (r + 1);
   Area1 = Area - Area2;
   // obtenemos el seno del angulo
   SenoDeAlpha = Area * 2 / (AB * BC);
   h2 = formulaDeSegundoGrado(BC, -(2 * Area2 + h * BC + 2 * Area1), 2
     * Area2 * h);
   h1 = h - h2;
   AD = h1 / SenoDeAlpha;
   // mostramos el resultado
   System.out.println(&quot;Case &quot; + caso + &quot;: &quot; + AD);
  }
 }

 /**
  * Obtiene uno de los resultados de la ecuacion de 2do grado ax2+bx+c
  * 
  * @author BreakDark (Jhonny Monrroy)
  * @version 1.0 beta 25/08/2013
  * @param a
  *            El coeficiente A de la ecuacion de 2do grado
  * @param b
  *            El coeficiente B de la ecuacion de 2do grado
  * @param c
  *            El coeficiente C de la ecuacion de 2do grado
  * @return uno de los valores de x a partir de la ecuacion ax2+bx+c
  */
 private static double formulaDeSegundoGrado(double a, double b, double c) {
  double dis = b * b - 4 * a * c; // discriminante
  if (dis &gt;= 0)
   return ((-b - Math.sqrt(dis)) / (2 * a));
  else
   System.out.println(&quot;El resultado es un numero imaginario :(&quot;);
  return 0;
 }

 /**
  * obtiene el area de un triangulo a partir de sus lados
  * 
  * @author BreakDark (Jhonny Monrroy)
  * @version 1.0 beta 12/08/2013
  * @param a
  *            Longitud del lado a del triangulo
  * @param b
  *            Longitud del lado b del triangulo
  * @param c
  *            Longitud del lado c del triangulo
  * @return El area del triangulo de lados a, b, c
  */
 private static double areaDelTriangulo(double a, double b, double c) {
  double s = (a + b + c) / 2; // semiperimetro
  return Math.sqrt(s * (s - a) * (s - b) * (s - c));
 }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/1066400769445971881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/1066400769445971881' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/1066400769445971881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/1066400769445971881'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/09/solucion-al-problema-1043-triangle.html' title='Solucion al Problema: 1043 - Triangle Partitioning [http://lightoj.com/] con java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-8953685273790177957</id><published>2016-09-15T20:32:00.002-07:00</published><updated>2016-09-15T20:32:16.306-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="LightOJ"/><title type='text'>Solución al problema 1001 - Opposite Task [http://www.lightoj.com] con java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://lightoj.com/volume_showproblem.php?problem=1001&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;

/**
 * 1001 - Opposite Task [http://www.lightoj.com]
 * 
 * @author BreakDark
 * @version 1.1 beta
 */
// ACEPTADO!!! xD
public class Main {
 public static void main(String[] args) {
  Scanner Lee; // para leer los datos de entrada
  byte T; // para el numero de casos de prueba
  byte n; // para el numero de problemas
  byte a; // para la computadora 1

  // AQUI INICIA EL PROGRAMA
  Lee = new Scanner(System.in);
  T = Lee.nextByte();
  while (T-- &gt; 0) {
   n = Lee.nextByte();
   if (n &gt;= 10) {
    a = (byte) (n - 10);
    System.out.println(a + &quot; &quot; + (n - a));
   } else
    System.out.println(&quot;0 &quot; + n);
  }
 }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/8953685273790177957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/8953685273790177957' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/8953685273790177957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/8953685273790177957'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/09/solucion-al-problema-1001-opposite-task.html' title='Solución al problema 1001 - Opposite Task [http://www.lightoj.com] con java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-5787251491886177844</id><published>2016-09-15T20:25:00.002-07:00</published><updated>2016-09-15T20:29:36.739-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="LightOJ"/><title type='text'>Solucion al problema: 1000 - Greetings from LightOJ [www.lightoj.com] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://lightoj.com/volume_showproblem.php?problem=1000&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;

/**
 * 1000 - Greetings from LightOJ [www.lightoj.com]
 * 
 * @author BreakDark
 * @version 1.0 beta
 */
// ACEPTADO!!! xD
public class Main {
 public static void main(String[] args) {
  Scanner Lee; // para leer l0os datos de entrada
  byte T; // numero de casos
  byte caso; // para contar los casos
  byte a, b; // problemas en cada computadora

  // AQUI INICIA EL PROGRAMA
  Lee = new Scanner(System.in);
  T = Lee.nextByte();
  for (caso = 1; caso &lt;= T; caso++) {
   a = Lee.nextByte();
   b = Lee.nextByte();
   System.out.println(&quot;Case &quot; + caso + &quot;: &quot; + (a + b));
  }
 }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/5787251491886177844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/5787251491886177844' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/5787251491886177844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/5787251491886177844'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/09/solucion-al-problema-1000-greetings.html' title='Solucion al problema: 1000 - Greetings from LightOJ [www.lightoj.com] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-5277280130789495898</id><published>2016-06-12T19:32:00.001-07:00</published><updated>2016-06-12T19:32:25.458-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="coj"/><title type='text'>Solucion al problema: 3056 - Automatic Checking Machine [http://coj.uci.cu] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://coj.uci.cu/24h/problem.xhtml?pid=3056&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;

/**
 * Solucion al problema: 3056 - Automatic Checking Machine [http://coj.uci.cu]
 * 
 * @author BreakDark (Jhonny Monrroy)
 * @version 1.0 beta 20/11/2014
 */
// Acepted!!! xD
public class Main {
    public static void main(String[] args) {
        Scanner Lee;
        boolean[] c1, c2;
        int i;
        boolean nocompatibles = false;

        // aca inicia el programa
        Lee = new Scanner(System.in);
        c1 = new boolean[5];
        c2 = new boolean[5];
        while (Lee.hasNext()) {
            nocompatibles = false;
            for (i = 0; i &lt; 5; i++)
                c1[i] = (Lee.nextInt() == 1);
            for (i = 0; i &lt; 5; i++)
                c2[i] = (Lee.nextInt() == 1);
            // buscamos si son compatibles
            for (i = 0; i &lt; 5; i++)
                if (c1[i] == c2[i]) {
                    nocompatibles = true;
                    break;
                }
            if (nocompatibles) {
                for (i = 0; i &lt; 5; i++)
                    if (c1[i] == c2[5 - 1 - i]) {
                        nocompatibles = true;
                        break;
                    }
            }
            System.out.println((nocompatibles) ? &quot;N&quot; : &quot;Y&quot;);
        }
    }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/5277280130789495898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/5277280130789495898' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/5277280130789495898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/5277280130789495898'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/06/solucion-al-problema-3056-automatic.html' title='Solucion al problema: 3056 - Automatic Checking Machine [http://coj.uci.cu] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-6263973040913656863</id><published>2016-06-12T19:30:00.001-07:00</published><updated>2016-06-12T19:30:03.650-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="coj"/><title type='text'>Solucion al problema: 1805 - A+B Complejo [http://coj.uci.cu] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://coj.uci.cu/24h/problem.xhtml?pid=1805&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;

/**
 * Solucion al problema: 1805 - A+B Complejo [http://coj.uci.cu]
 * 
 * @author BreakDark (Jhonny Monrroy)
 * @version 1.0 beta 11 de jun. de 2016
 */
// Accepted!!! xD
public class Main {
    public static void main(String[] args) {
        Scanner Lee; // para leer los datos
        long a, b;
        long suma;

        // AQUI INICIA EL PROGRAMA
        Lee = new Scanner(System.in);
        a = Lee.nextInt();
        b = Lee.nextInt();
        suma = 2 * a + 2 * b; // 2a+2b = (a+b) + (a-b) + (b+a) + (b-a)
        System.out.println(suma);
        Lee.close();
    }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/6263973040913656863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/6263973040913656863' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/6263973040913656863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/6263973040913656863'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/06/solucion-al-problema-1805-ab-complejo.html' title='Solucion al problema: 1805 - A+B Complejo [http://coj.uci.cu] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-73451951677867255</id><published>2016-06-12T19:28:00.001-07:00</published><updated>2016-06-12T19:28:04.600-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="coj"/><title type='text'>Solución al problema: 1666 - WERTYU [http://coj.uci.cu/] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://coj.uci.cu/24h/problem.xhtml?pid=1666&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;

/**
 * 1666 - WERTYU [http://coj.uci.cu/]
 * 
 * @author BreakDark
 * @version 1.1 beta
 */
// ACEPTADO!!! xD
public class Main {
 public static void main(String[] args) {
  Scanner Lee;
  String cadena, salida;
  int i;

  // AQUI INICIA EL PROGRAMA
  Lee = new Scanner(System.in);
  while (Lee.hasNextLine()) {
   cadena = Lee.nextLine();
   salida = &quot;&quot;;
   for (i = 0; i &lt; cadena.length(); i++) {
    switch (cadena.charAt(i)) {
    case &#39;W&#39;:
     salida += &#39;Q&#39;;
     break;
    case &#39;S&#39;:
     salida += &#39;A&#39;;
     break;
    case &#39;X&#39;:
     salida += &#39;Z&#39;;
     break;
    case &#39;E&#39;:
     salida += &#39;W&#39;;
     break;
    case &#39;D&#39;:
     salida += &#39;S&#39;;
     break;
    case &#39;C&#39;:
     salida += &#39;X&#39;;
     break;
    case &#39;R&#39;:
     salida += &#39;E&#39;;
     break;
    case &#39;F&#39;:
     salida += &#39;D&#39;;
     break;
    case &#39;V&#39;:
     salida += &#39;C&#39;;
     break;
    case &#39;T&#39;:
     salida += &#39;R&#39;;
     break;
    case &#39;G&#39;:
     salida += &#39;F&#39;;
     break;
    case &#39;B&#39;:
     salida += &#39;V&#39;;
     break;
    case &#39;Y&#39;:
     salida += &#39;T&#39;;
     break;
    case &#39;H&#39;:
     salida += &#39;G&#39;;
     break;
    case &#39;N&#39;:
     salida += &#39;B&#39;;
     break;
    case &#39;U&#39;:
     salida += &#39;Y&#39;;
     break;
    case &#39;J&#39;:
     salida += &#39;H&#39;;
     break;
    case &#39;M&#39;:
     salida += &#39;N&#39;;
     break;
    case &#39;I&#39;:
     salida += &#39;U&#39;;
     break;
    case &#39;K&#39;:
     salida += &#39;J&#39;;
     break;
    case &#39;,&#39;:
     salida += &#39;M&#39;;
     break;
    case &#39;O&#39;:
     salida += &#39;I&#39;;
     break;
    case &#39;L&#39;:
     salida += &#39;K&#39;;
     break;
    case &#39;.&#39;:
     salida += &#39;,&#39;;
     break;
    case &#39;P&#39;:
     salida += &#39;O&#39;;
     break;
    case &#39;;&#39;:
     salida += &#39;L&#39;;
     break;
    case &#39;/&#39;:
     salida += &#39;.&#39;;
     break;
    case &#39;2&#39;:
     salida += &#39;1&#39;;
     break;
    case &#39;3&#39;:
     salida += &#39;2&#39;;
     break;
    case &#39;4&#39;:
     salida += &#39;3&#39;;
     break;
    case &#39;5&#39;:
     salida += &#39;4&#39;;
     break;
    case &#39;6&#39;:
     salida += &#39;5&#39;;
     break;
    case &#39;7&#39;:
     salida += &#39;8&#39;;
     break;
    case &#39;8&#39;:
     salida += &#39;7&#39;;
     break;
    case &#39;9&#39;:
     salida += &#39;8&#39;;
     break;
    case &#39;0&#39;:
     salida += &#39;9&#39;;
     break;
    case &#39;-&#39;:
     salida += &#39;0&#39;;
     break;
    case &#39;=&#39;:
     salida += &#39;-&#39;;
     break;
    case &#39;[&#39;:
     salida += &#39;P&#39;;
     break;
    case &#39;]&#39;:
     salida += &#39;[&#39;;
     break;
    case &#39;\\&#39;:
     salida += &#39;]&#39;;
     break;
    case &#39;\&#39;&#39;:
     salida += &#39;;&#39;;
     break;
    case &#39; &#39;:
     salida += &#39; &#39;;
     break;
    }
   }
   System.out.println(salida);
  }
 }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/73451951677867255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/73451951677867255' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/73451951677867255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/73451951677867255'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/06/solucion-al-problema-1666-wertyu.html' title='Solución al problema: 1666 - WERTYU [http://coj.uci.cu/] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-290302148979433790</id><published>2016-06-12T19:25:00.005-07:00</published><updated>2016-06-12T19:25:58.170-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="coj"/><title type='text'>Solución al problema: 1663 - Error Correction [http://coj.uci.cu/] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://coj.uci.cu/24h/problem.xhtml?pid=1663&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;

/**
 * 1663 - Error Correction [http://coj.uci.cu/]
 * 
 * @author BreakDark
 * @version 1.1 beta
 */
// ACEPTADO!!! xD
public class Main {
 public static void main(String[] args) {
  Scanner Lee;
  byte N;
  boolean[][] mat;
  byte i, j;
  byte sum;
  byte fil, col;

  // AQUI INICIA EL PROGRAMA
  Lee = new Scanner(System.in);
  N = Lee.nextByte();
  while (N &gt; 0) {
   mat = new boolean[N][N];
   fil = col = -1;
   for (i = 0; i &lt; N; i++)
    for (j = 0; j &lt; N; j++)
     mat[i][j] = (Lee.nextByte() == 1) ? true : false;
   if (cumpleParidad(mat))
    System.out.println(&quot;OK&quot;);
   else {
    // buscamos errores en filas
    for (i = 0; i &lt; N; i++) {
     sum = 0;
     for (j = 0; j &lt; N; j++)
      if (mat[i][j])
       sum++;
     if ((sum &amp; 1) == 1) {
      fil = i;
      break;
     }
    }
    if (fil &gt; 0) {
     // buscamos errores en columnas
     for (j = 0; j &lt; N; j++) {
      sum = 0;
      for (i = 0; i &lt; N; i++)
       if (mat[i][j])
        sum++;
      if ((sum &amp; 1) == 1) {
       col = j;
       break;
      }
     }
    }
    // reparamos
    if (fil &gt;= 0 &amp;&amp; col &gt;= 0)
     mat[fil][col] = !mat[fil][col];
    if (cumpleParidad(mat))
     System.out.println(&quot;Change bit (&quot; + (fil + 1) + &quot;,&quot;
       + (col + 1) + &quot;)&quot;);
    else
     System.out.println(&quot;Corrupt&quot;);
   }
   N = Lee.nextByte();
  }
 }

 /** Para comprobar si la matriz cumple con la paridad */
 private static boolean cumpleParidad(boolean[][] mat) {
  byte i, j;
  byte sum;
  // buscamos filas
  for (i = 0; i &lt; mat.length; i++) {
   sum = 0;
   for (j = 0; j &lt; mat.length; j++)
    if (mat[i][j])
     sum++;
   if ((sum &amp; 1) == 1)
    return false;
  }
  // buscamos columnas
  for (j = 0; j &lt; mat.length; j++) {
   sum = 0;
   for (i = 0; i &lt; mat.length; i++)
    if (mat[i][j])
     sum++;
   if ((sum &amp; 1) == 1)
    return false;
  }
  return true;
 }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/290302148979433790/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/290302148979433790' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/290302148979433790'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/290302148979433790'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/06/solucion-al-problema-1663-error.html' title='Solución al problema: 1663 - Error Correction [http://coj.uci.cu/] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-1069717050253449000</id><published>2016-06-12T19:23:00.002-07:00</published><updated>2016-06-12T19:23:26.157-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="coj"/><title type='text'>Solución al problema: 1662 - Run-Length Encoding-Decoding [http://coj.uci.cu/] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://coj.uci.cu/24h/problem.xhtml?pid=1662&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;

/**
 * 1662 - Run-Length Encoding-Decoding [http://coj.uci.cu/]
 * 
 * @author BreakDark
 * @version 1.0 beta
 */
// ACEPTADO!!! xD
public class Main {
 public static void main(String[] args) {
  Scanner Lee;
  byte T;
  byte caso;
  String cadena, salida;
  char letra;
  int i, j;
  String aux;

  // AQUI INICIA EL PROGRAMA
  Lee = new Scanner(System.in);
  T = Lee.nextByte();
  for (caso = 1; caso &lt;= T; caso++) {
   System.out.print(&quot;Case &quot; + caso + &quot;: &quot;);
   cadena = Lee.next();
   salida = &quot;&quot;;
   letra = cadena.charAt(0);
   aux = &quot;&quot;;
   for (i = 1; i &lt; cadena.length(); i++) {
    if (cadena.charAt(i) &gt;= &#39;0&#39; &amp;&amp; cadena.charAt(i) &lt;= &#39;9&#39;)
     aux += cadena.charAt(i);
    else {
     for (j = 0; j &lt; Integer.parseInt(aux); j++)
      salida += letra;
     letra = cadena.charAt(i);
     aux = &quot;&quot;;
    }
   }
   for (j = 0; j &lt; Integer.parseInt(aux); j++)
    salida += letra;
   System.out.println(salida);
  }
 }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/1069717050253449000/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/1069717050253449000' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/1069717050253449000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/1069717050253449000'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/06/solucion-al-problema-1662-run-length.html' title='Solución al problema: 1662 - Run-Length Encoding-Decoding [http://coj.uci.cu/] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-6238408208204191542</id><published>2016-06-12T19:20:00.002-07:00</published><updated>2016-06-12T19:20:21.493-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="coj"/><title type='text'>Solución al problema: 1655 - Xtreme Encription [http://coj.uci.cu/] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://coj.uci.cu/24h/problem.xhtml?pid=1655&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;

/**
 * 1655 - Xtreme Encription [http://coj.uci.cu/]
 * 
 * @author BreakDark
 * @version 1.0 beta
 */
// ACEPTADO!!! xD
public class Main {
 public static void main(String[] args) {
  Scanner Lee;
  String texto, texto2;
  int i, j;

  // AQUI INICIA EL PROGRAMA
  Lee = new Scanner(System.in);
  while (Lee.hasNext()) {
   texto = Lee.next();
   texto2 = Lee.next();
   i = j = 0;
   while (i &lt; texto.length() &amp;&amp; j &lt; texto2.length()) {
    if (texto.charAt(i) == texto2.charAt(j))
     i++;
    j++;
   }
   if (i == texto.length())
    System.out.println(&quot;Yes&quot;);
   else
    System.out.println(&quot;No&quot;);
  }
 }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/6238408208204191542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/6238408208204191542' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/6238408208204191542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/6238408208204191542'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/06/solucion-al-problema-1655-xtreme.html' title='Solución al problema: 1655 - Xtreme Encription [http://coj.uci.cu/] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-5985313592289009247</id><published>2016-06-12T19:17:00.002-07:00</published><updated>2016-06-12T19:17:27.675-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="coj"/><title type='text'>Solucion al problema: 1495 - Increasing Order List [http://coj.uci.cu] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://coj.uci.cu/24h/problem.xhtml?pid=1495&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Solucion al problema: 1495 - Increasing Order List [http://coj.uci.cu]
 * 
 * @author BreakDark (Jhonny Monrroy)
 * @version 1.0 beta 12 de jun. de 2016
 */
// Accepted!!! xD
public class Main {
    public static void main(String[] args) {
        Scanner Lee; // para leer datos
        int[] ni; // lista de enteros
        int n; // numero de enteros

        // AQUI INICIA EL PROGRAMA
        Lee = new Scanner(System.in);
        n = Lee.nextInt();
        ni = new int[n];
        for (int i = 0; i &lt; n; i++) {
            ni[i] = Lee.nextInt();
        }
        Arrays.sort(ni);
        for (int i = 0; i &lt; n; i++) {
            System.out.println(ni[i]);
        }
        Lee.close();
    }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/5985313592289009247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/5985313592289009247' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/5985313592289009247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/5985313592289009247'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/06/solucion-al-problema-1495-increasing.html' title='Solucion al problema: 1495 - Increasing Order List [http://coj.uci.cu] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-3387930702996622810</id><published>2016-06-12T19:14:00.003-07:00</published><updated>2016-06-12T19:14:33.324-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="coj"/><title type='text'>Solucion al problema: 1494 - Hey don&#39;t Read!!! [http://coj.uci.cu] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://coj.uci.cu/24h/problem.xhtml?pid=1494&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
/**
 * Solucion al problema: 1494 - Hey don&#39;t Read!!! [http://coj.uci.cu]
 * 
 * @author BreakDark (Jhonny Monrroy)
 * @version 1.0 beta 19/11/2014
 */
// Accepted!!! xD
public class Main {
    public static void main(String[] args) {
        System.out.println(&quot;I got my first solution!!!&quot;);
    }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/3387930702996622810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/3387930702996622810' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/3387930702996622810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/3387930702996622810'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/06/solucion-al-problema-1494-hey-dont-read.html' title='Solucion al problema: 1494 - Hey don&#39;t Read!!! [http://coj.uci.cu] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-1069509215970093180</id><published>2016-06-12T19:12:00.006-07:00</published><updated>2016-06-12T19:12:37.502-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="coj"/><title type='text'>Solucion al problema: 1312 - R2 [http://coj.uci.cu] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://coj.uci.cu/24h/problem.xhtml?pid=1312&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;

/**
 * Solucion al problema: 1312 - R2 [http://coj.uci.cu]
 * 
 * @author BreakDark (Jhonny Monrroy)
 * @version 1.0 beta 19/11/2014
 */
// Accepted!!! xD
public class Main {
    public static void main(String[] args) {
        Scanner Lee; // para leer los datos de entrada
        int r1, r2, s;

        // aqui inicia el programa
        Lee = new Scanner(System.in);
        r1 = Lee.nextInt();
        s = Lee.nextInt();
        r2 = (s &lt;&lt; 1) - r1;
        System.out.println(r2);
    }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/1069509215970093180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/1069509215970093180' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/1069509215970093180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/1069509215970093180'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/06/solucion-al-problema-1312-r2.html' title='Solucion al problema: 1312 - R2 [http://coj.uci.cu] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-5493648222597852153</id><published>2016-06-12T19:10:00.001-07:00</published><updated>2016-06-12T19:10:20.160-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="coj"/><title type='text'>Solucion al problema: 1156 - La Vida, El Universo y El Todo  [http://coj.uci.cu] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://coj.uci.cu/24h/problem.xhtml?pid=1156&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Scanner;

/**
 * Solucion al problema: 1156 - La Vida, El Universo y El Todo
 * [http://coj.uci.cu]
 * 
 * @author BreakDark (Jhonny Monrroy)
 * @version 1.0 beta 1 de jun. de 2016
 */
// Accepted!!! xD
public class Main {
    public static void main(String[] args) {
        Scanner Lee; // Pasra leer los datos de entrada
        int i; // para los datos de entrada

        // AQUI INICIA EL PROGRAMA
        Lee = new Scanner(System.in);
        while (Lee.hasNext()) {
            i = Lee.nextInt();
            if (i == 42) {
                break;
            }
            System.out.println(i);
        }
    }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/5493648222597852153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/5493648222597852153' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/5493648222597852153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/5493648222597852153'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/06/solucion-al-problema-1156-la-vida-el.html' title='Solucion al problema: 1156 - La Vida, El Universo y El Todo  [http://coj.uci.cu] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-3136585325380360974</id><published>2016-06-12T19:08:00.002-07:00</published><updated>2016-06-12T19:08:25.551-07:00</updated><title type='text'>Solucion al problema: 1102 - You Can Say 11 [http://coj.uci.cu] con java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://coj.uci.cu/24h/problem.xhtml?pid=1102&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.math.BigInteger;
import java.util.Scanner;

/**
 * Solucion al problema: 1102 - You Can Say 11 [http://coj.uci.cu]
 * 
 * @author BreakDark (Jhonny Monrroy)
 * @version 1.0 beta 11 de jun. de 2016
 */
// Accepted!!! xD
public class Main {
    public static void main(String[] args) {
        Scanner Lee; // para ler datos
        BigInteger n; // el numero a evaluar

        BigInteger once = new BigInteger(&quot;11&quot;);

        // AQUI INICIA EL PROGRAMA
        Lee = new Scanner(System.in);
        n = new BigInteger(Lee.next());
        while (!n.equals(BigInteger.ZERO)) {
            if (n.mod(once).equals(BigInteger.ZERO)) {
                System.out.println(n + &quot; is a multiple of 11.&quot;);
            } else {
                System.out.println(n + &quot; is not a multiple of 11.&quot;);
            }
            n = new BigInteger(Lee.next());
        }
        Lee.close();
    }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/3136585325380360974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/3136585325380360974' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/3136585325380360974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/3136585325380360974'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/06/solucion-al-problema-1102-you-can-say.html' title='Solucion al problema: 1102 - You Can Say 11 [http://coj.uci.cu] con java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19962453.post-7181101149590915197</id><published>2016-06-12T19:06:00.000-07:00</published><updated>2016-06-12T19:06:10.820-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACM ICPC"/><category scheme="http://www.blogger.com/atom/ns#" term="coj"/><title type='text'>Solución al problema: 1099 - Pythagorean Numbers [http://coj.uci.cu] con Java</title><content type='html'>Para ver el link del problema &lt;a href=&quot;http://coj.uci.cu/24h/problem.xhtml?pid=1099&quot; target=&quot;_blank&quot;&gt;Click aqui&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

/**
 * 1099 - Pythagorean Numbers [http://coj.uci.cu]
 * 
 * @author BreakDark
 * @version 1.0 beta
 */
// ACEPTADO!!! xD
public class Main {
    public static void main(String[] args) {
        Scanner Lee; // para leer los datos de entrada
        String linea; // para leer una linea
        StringTokenizer LeerLinea;
        short[] num = new short[3]; // para la trica phitagorica

        // AQUI INICIA EL PROGRAMA
        Lee = new Scanner(System.in);
        // leemos los datos
        linea = Lee.nextLine();
        while (!linea.equals(&quot;0&quot;)) {
            LeerLinea = new StringTokenizer(linea);
            num[0] = Short.parseShort(LeerLinea.nextToken());
            num[1] = Short.parseShort(LeerLinea.nextToken());
            num[2] = Short.parseShort(LeerLinea.nextToken());
            Arrays.sort(num); // ordenamos
            // mostramos el resultado
            if (num[0] * num[0] + num[1] * num[1] == num[2] * num[2])
                System.out.println(&quot;right&quot;);
            else
                System.out.println(&quot;wrong&quot;);
            linea = Lee.nextLine();
        }
    }
}

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://breakdark.blogspot.com/feeds/7181101149590915197/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19962453/7181101149590915197' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/7181101149590915197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19962453/posts/default/7181101149590915197'/><link rel='alternate' type='text/html' href='http://breakdark.blogspot.com/2016/06/solucion-al-problema-1099-pythagorean.html' title='Solución al problema: 1099 - Pythagorean Numbers [http://coj.uci.cu] con Java'/><author><name>BreakDark</name><uri>http://www.blogger.com/profile/09828076399426284229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>