Solucion problema d
Posted by team 19 - CW on August Sat 11th 6:53 PM - Never Expires| View : 144Syntax: JAVA
1103 characters | 42 lines | 1.08 KB
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- import java.io.IOException;
- import java.util.Arrays;
- import java.util.Scanner;
- /**
- *
- *
- */
- public class yunsa {
- /**
- * @param args the command line arguments
- */
- int casos=sc.nextInt();
- for (int i = 0; i < casos; i++) {
- int alumnos=sc.nextInt();
- int[]lista=new int[alumnos];
- for (int j = 0; j < alumnos; j++) {
- lista[j]=sc.nextInt();
- }
- int mayor=lista[1]-lista[0];
- for (int j = 0; j < lista.length-2; j++) {
- if (lista[j+2]-lista[j]>mayor)
- mayor=lista[j+2]-lista[j];
- }
- if (lista[alumnos-1]-lista[alumnos-2]>mayor)
- mayor=lista[alumnos-1]-lista[alumnos-2];
- }
- }
- }
