小白的算法实战(二):交通灯问题


#include 
#include 
using namespace std;
class Node
{
public:
    int color;
    string name;
    Node()
    {
        color=0;
    }
};
int main()
{
    int i,j,cnt_color=1,cnt_v=0;
    int e[13][13]={
0,0,0,0,1,1,1,1,0,1,1,1,0,
0,0,0,0,0,1,1,1,0,0,1,1,0,
0,0,0,0,0,1,0,0,0,1,1,1,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,
1,0,0,0,0,0,1,1,0,0,1,1,0,
1,1,1,0,0,0,1,0,0,0,1,1,0,
1,1,0,0,1,1,0,0,0,0,1,1,0,
1,1,0,0,1,0,0,0,0,0,0,1,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,
1,0,1,0,0,0,0,0,0,0,0,0,0,
1,1,1,0,1,1,1,0,0,0,0,0,0,
1,1,1,0,1,1,1,1,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0};
    Node vertex[13];
    vertex[0].name="AB";
    vertex[1].name="AC";
    vertex[2].name="AD";
    vertex[3].name="BA";
    vertex[4].name="BC";
    vertex[5].name="BD";
    vertex[6].name="DA";
    vertex[7].name="DB";
    vertex[8].name="DC";
    vertex[9].name="EA";
    vertex[10].name="EB";
    vertex[11].name="EC";
    vertex[12].name="ED";
    for(i=0;i<13 && cnt_v<13;i++)
    {
	int flag=1;
        if(vertex[i].color==0)
        {
            vertex[i].color=cnt_color;
            cout<<"第"<

 

你可能感兴趣的:(算法实战)