runtime error on test 11

Правка en1, от soumiaMoufid, 2017-02-17 04:59:52

please i got "runtime error on test 11" with this code any help?? thanks in advance



import java.io.PrintWriter; import java.util.Scanner; public class GregAndGraph { int [][]graph;//pour stocker la matrice de graphe int []noeudSupp;//pour les noeuds supprimer int []somme;//somme de plus court chemin int [][] data; public GregAndGraph() { //saisie Scanner in = new Scanner(System.in); PrintWriter out=new PrintWriter (System.out); int n=in.nextInt(); graph=new int[n+1][n+1]; data=new int[n+1][n+1]; noeudSupp=new int[n+1]; somme=new int[n+1]; int []id=new int[30]; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ graph[i][j]=in.nextInt(); data[i][j]=graph[i][j]; } } for(int i=1;i<=n;i++){ noeudSupp[i]=in.nextInt(); id[noeudSupp[i]]=i; somme[i]=0; } for (int k = 1; k <= n; k++) { for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { graph[i][j] = Math.min(graph[i][j], graph[i][noeudSupp[n-k+1]] + graph[noeudSupp[n-k+1]][j]); if (id[i] > n-k && id[j] > n-k) somme[k] += graph[i][j]; } } } for (int k = n; k >= 1; k--) { System.out.print(somme[k] + " "); } } public static void main(String[] args) { new GregAndGraph(); } }

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский soumiaMoufid 2017-02-17 04:59:52 1466 Initial revision (published)