Sunday, June 12, 2016

Solucion al problema: 1102 - You Can Say 11 [http://coj.uci.cu] con java

Para ver el link del problema Click aqui
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("11");

        // 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 + " is a multiple of 11.");
            } else {
                System.out.println(n + " is not a multiple of 11.");
            }
            n = new BigInteger(Lee.next());
        }
        Lee.close();
    }
}

No comments: