import java.util.Scanner;
/**
* 1003 - General Election [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
byte T; // casos de prueba
byte n, m; // candidatos y regiones
int[] suma; // vector de la suma de los candidatos
int sumaMax; // suma maxima
int i, j; // indices
// AQUI INICIA EL PROGRAMA
Lee = new Scanner(System.in);
// leemos los datos
T = Lee.nextByte();
while (T-- > 0) {
n = Lee.nextByte();
m = Lee.nextByte();
suma = new int[n];
// sumamos y calculamos
sumaMax = Integer.MIN_VALUE;
for (i = 0; i < m; i++)
for (j = 0; j < n; j++) {
suma[j] += Lee.nextInt();
if (suma[j] > sumaMax)
sumaMax = suma[j];
}
// mostramos al ganador
for (i = 0; i < n; i++)
if (suma[i] == sumaMax) {
System.out.println(i + 1);
break;
}
}
}
}
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.
Sunday, June 12, 2016
Solucion al problema: 1003 - General Election [http://coj.uci.cu] en Java
Para ver el link del problema Click aqui
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment