alonsosjumper

ejercicio 3 práctica 8

Aug 22nd, 2011
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. int Distribucion(Ciudad Origen,int Cantidad,Grafo G,Ciu Almacen,Ciu Subvencion)
  2. {
  3. int i,j,min=0;
  4. tCoste **A,B[G->numVert];
  5. tCoste a;
  6. vertice **P;
  7.  
  8. Floyd(G,&A,&P);
  9.  
  10. for(i=0;i<G->numVert;i++)
  11. for(j=0;j<Subvencion->total;j++)
  12. if(i==Subvencion->A[j]->C)
  13. B[i]=A[Origen][i]*Subvencion->A[j]->dato/100;
  14.  
  15. for(i=0;i<G->numVert;i++)
  16. if(B[i]>B[i+1])
  17. {
  18. a=B[i];
  19. B[i]=B[i+1];
  20. B[i+1]=a;
  21. }
  22. for(i=0;Cantidad>0 || G->numVert;i++)
  23. for(j=0;j<Almacen->total;j++)
  24. if(B[i]==Almacen->C[j]->C)
  25. {
  26. Cantidad=Cantidad-Almacen->C[j]->dato;
  27. min=min+B[i]*Almacen->C[j]->dato;
  28. }
  29. return min;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment