编程之美里很tricky的解法明天去看一看
#include <iostream>
using namespace std;typedef struct Node
{char data;struct Node* next;
}Node, *pNode;pNode Init(char* a, int len)
{int i;pNode head, p, q;head = new Node();head->data = a[0];q = head;for (i = 1; i < len; ++i){p = new Node();p->data = a[i];q->next = p;q = p;}q->next = NULL;return head;
}void printList(pNode p)
{while(p){cout<<p->data<<" ";if (p->next){p = p->next;}else{cout<<endl;break;}}
}pNode findCircle(pNode p , int bitmap)
{while(p){if (bitmap & (1 << (p->data - 'A'))){return p;}bitmap |