Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
题目和程序都看了N遍,我实在是找不出有什么错谁能教教我? #include<iostream> using namespace std; int main(){ unsigned int number; while(cin>>number){ char time[1000020]; //用于放间隔,如1 3存为time[1]不变,time[2]=time[3]=1; char pop[1000020]; //用于存放点 memset(time, 0, 1000020*sizeof(char)); memset(pop, 0, 1000020*sizeof(char)); unsigned int top=0; while(number-->0){ unsigned int left,right; cin>>left>>right; if(right>top) top=right; if(left==right){ pop[left]++; continue; } left++; while(left<=right){ time[left]++; left++; } } int in=0; for(number=0;number<=top+1;number++){ if(time[number]){ if(in==0){ in=1; cout<<number-1<<" "; } } else{ if(in){ in=0; cout<<number-1<<endl; } if(pop[number] && !time[number+1]){ cout<<number<<" "<<number<<endl; } } } } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator