Thursday, June 28, 2012

Solución a 69A - Young Physicist [http://www.codeforces.com] con Java

Solución a 69A - Young Physicist [http://www.codeforces.com] el enlace del problema está en el siguiente link

import java.util.Scanner;

/**
 * Problema 69A - Young Physicist [http://www.codeforces.com]
 * 
 * @author BreakDark
 * @version 1.0 beta
 */
// ACEPTADO!!! :)
public class Main {
 public static void main(String[] args) {
  Scanner Lee;
  byte n;
  byte x, y, z;
  // AQUI INICIA EL PROGRAMA
  Lee = new Scanner(System.in);
  while (Lee.hasNext()) {
   n = Lee.nextByte();
   x = y = z = 0;
   while (n > 0) {
    x += Lee.nextByte();
    y += Lee.nextByte();
    z += Lee.nextByte();
    n--;
   }
   if ((x == 0) && (y == 0) && (z == 0))
    System.out.println("YES");
   else
    System.out.println("NO");
  }
 }
}

No comments: