关于编程的问题有m台不同的机器,
#include "draw。h"
#include
#include
#include
#include
#include
#include
#include
#include "time。 h"
using namespace std;
#define MAX 20
#define C 5 //how many machine
unsigned long color[]={
ezdWhite,
ezdBlue,
ezdTeal,
ezdGreen,
ezdTurquoise,
ezdDarkGray,
ezdBrown,
ezdPurple,
ezdLightBlue,
ezd...全部
#include "draw。h"
#include
#include
#include
#include
#include
#include
#include
#include "time。
h"
using namespace std;
#define MAX 20
#define C 5 //how many machine
unsigned long color[]={
ezdWhite,
ezdBlue,
ezdTeal,
ezdGreen,
ezdTurquoise,
ezdDarkGray,
ezdBrown,
ezdPurple,
ezdLightBlue,
ezdLightGray,
ezdGold,
ezdRed,
ezdOrange,
ezdPink,
ezdYellow,
ezdBlack};
struct node{
int m;
int t;
};
int best;
int n=0;
int mtime[C];
int mi;
int wtime[MAX];
int wi;
int se[MAX][C];
int p[MAX][C];
int all[MAX];
list ::iterator Iter;
list worklist[MAX];
list mlist[C];
int gra();
int sort1()
{
int i;
mi=0;
for(i=0;imtime[i])
{
mi=i;
}
}
return 0;
}
int sort2()
{
int i;
int temp;
int temp1;
int temp2;
temp2=0;
temp1=10000;
wi=-1;
for(i=0;imtime[mi])
temp=wtime[i];
else temp=mtime[mi];
temp=temp+(*Iter)。
t;
if(temptemp2)
{
temp2=all[i];
wi=i;
}
}
}
}
return 0;
}
int main()
{
int i;
int j;
int temp;
char s[30];
FILE *stream;
node tempnode;
cout>s;
strcpy(s,"la06。
txt");
stream = fopen( s, "r" );
//system("pause");
i=0;
while(fscanf(stream,"%d",&se[n][i])==1)
{
fscanf(stream,"%d",&p[n][i]);
all[n]=p[n][i];
for(i=1;imtime[mi])
temp=wtime[wi];
else temp=mtime[mi];
temp=temp+(*Iter)。
t;
if((temp-mtime[mi])!=(*Iter)。t)
{
tempnode。m=-1;
tempnode。t=temp-mtime[mi]-(*Iter)。
t;
mlist[mi]。push_back(tempnode);
}
all[wi]=all[wi]-(*Iter)。t;
tempnode。m=wi;
tempnode。
t=(*Iter)。t;
mlist[mi]。push_back(tempnode);
mtime[mi]=temp;
wtime[wi]=temp;
worklist[wi]。
erase(worklist[wi]。begin());
i++;
}
}
best=0;
for(i=0;ibest)
best=mtime[i];
}
cout<<"the all time: "< begin( ); Iter != mlist[i]。end( ); Iter++ )
{
if((*Iter)。m!=-1)
cout << " " << (*Iter)。
m;
}
cout << endl;
}
gra();
return 0;
}
int gra()
{
double xx,yy,zz;
int i;
openWindow();
resizeWindow(0,0,100,100);
xx=100。
0/best;
yy=5;
ezdSetColor(color[0]);
ezdDrawRectangle(0,0,100,100);
for(i=0;i begin( ); Iter != mlist[i]。end( ); Iter++ )
{
ezdSetColor(color[(*Iter)。m+1]);
ezdDrawRectangle(zz,i*yy*2,zz+(*Iter)。
t*xx,2*i*yy+yy);
zz+=(*Iter)。t*xx;
}
}
viewWindow();
closeWindow();
return 0;
}
。
收起