标签:
题目:
#include<iostream> 2 using namespace std; 3 4 void main(){ 5 int arr_List[10]={1,2,4,5,5,5,3,5,5,5};/ 6 int front=0,rear=1; 7 8 9 for(int count_List=1 ; count_list<10 ; count_List++ ) { 10 if(arr_List[front]!=arr_List[rear]) 11 { 12 if(front==0) { 13 rear++; front=rear; rear++; 14 } 15 else { 16 front--; rear++; 17 } 18 } 19 else{ 20 front=rear; front++; 21 } 22 } 23 24 cout<<"水王ID为:"<<arr_List[front]<<endl; 25 }
标签:
原文地址:http://www.cnblogs.com/huazongzong/p/4461659.html