P1047
#include<stdio.h> int main() { int i, sum = 0, a, b, c; scanf("%d", &i); int lenth[i]; for(a = 0; a <= i; a++){ lenth[a] = 1; } int n; scanf("%d", &n); int start[n], end[n]; for(b = 1;b <= n; b++){ scanf("%d %d",&start[b], &end[b]); } for(b = 1; b <= n; b++){ for(c = 1;c <= i; c++){ if(c >= start[b] && c <= end[b]){ lenth[c] = 0; } } } for(a = 0; a <= i; a++){ sum = sum + lenth[a]; print } printf("%d",sum); return 0; }