poj 2665(水题)


#include
using namespace std;
int main(){
    int l,m,result,start,end;
    while(scanf("%d%d",&l,&m)==2&&l){
        result = l+1;
        while(m--){
            scanf("%d%d",&start,&end);
            result-=end-start+1;
        }
        printf("%d\n",result);
    }
    return 0;
}

相关