poj2665 Trees!

 
#include<cstdio>
using namespace std;
int main(){
	
	while(1){
		int count,section;
		scanf("%d %d",&count,§ion);
		if(0==count&&0==section){
			break;
		}
	
		int left=count+1;
		while(section--){
			int start,end;
			scanf("%d%d",&start,&end);
			if(start==0&&end==0){
				break;
			}
			left=left-(end-start+1);
		}
		printf("%d\n",left);
	}
	
}

你可能感兴趣的:(poj2665 Trees!)