#include <stdbool.h>
/**
 * struct ListNode {
 *	int val;
 *	struct ListNode *next;
 * };
 */

/**
 * 
 * @param head ListNode类 
 * @return bool布尔型
 */
bool hasCycle(struct ListNode* head ) {
    // write code here
    struct ListNode *fastpointer=head,*slowpointer =head;
  while(fastpointer!=NULL&&fastpointer->next!=NULL)
   {
fastpointer=fastpointer->next->next;
slowpointer=slowpointer->next;
    if(slowpointer==fastpointer)
    {
        return true;
    }
   }
   return false;
}