/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *entryNodeOfLoop(ListNode *head) {
ListNode *now=head;
while(now!=NULL)
{
if(now->val<0)
{
now->val=-now->val; //非明令禁止者,皆无不可能
return now;
}
else
{
now->val=-now->val;
now=now->next;
}
}
return NULL;
}
};