me podrian ayudar realizar este codigo porfavor
Publicado por isak (10 intervenciones) el 25/07/2020 21:23:14
realizar un programa que resuelva el metodo noroeste programacion lineal
ejemplo de entrada
oferta 4
100 120 80 95
demanda 4
125 50 130 90
salida
100 0 0 0
25 50 45 0
0 0 80 0
0 0 5 90
ejemplo de entrada
oferta 4
100 120 80 95
demanda 4
125 50 130 90
salida
100 0 0 0
25 50 45 0
0 0 80 0
0 0 5 90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
int main(){
int f,c;
int ofertas[100], demandas[100],m[100][100];
int i,x=0,y=0;
cin>>f>>c;
for(i=0; i<f; i++){
cout<<"ingrese la oferta: ";
cin>>ofertas[i];
}
for(i=0; i<c; i++){
cout<<"ingrese la demandas: ";
cin>>demandas[i];
}
for(x=0;x<f;x++){
printf("\n");
for(y=0; y<c; y++){
m[x][y]=0;
if(ofertas[x]>demandas[x]){
m[x][x]=demandas[x];
m[x][x+1]=ofertas[x]-demandas[x];
}else
if(ofertas[y]<demandas[y]){
m[y][y]=ofertas[y];
m[y+1][y]=demandas[y]-ofertas[y];
}
}
}
for(int x=0;x<f;x++){
cout<<"\n";
for(int y=0; y<c; y++)
cout<<"\t"<<m[x][y]<<" ";}
return 0;
}
Valora esta pregunta


0