POJ 2894
1 #include<iostream> 2 #define MAXN 1005 3 using namespace std; 4 5 int a[MAXN]; 6 7 int main() 8 { 9 //freopen("acm.acm","r",stdin); 10 int test; 11 int num; 12 char c; 13 int i; 14 int j; 15 int x; 16 int max; 17 int y; 18 cin>>test; 19 while(test --) 20 { 21 memset(a,0,sizeof(a)); 22 cin>>num; 23 max = -1; 24 for(i = 0; i < num; ++ i) 25 { 26 cin>>c; 27 cin>>x>>y; 28 if(x > max) 29 max = x; 30 if(y > max) 31 max = y; 32 for(j = x; j < y; ++ j) 33 { 34 ++ a[j]; 35 } 36 } 37 for(i = 0; i < max; ++ i) 38 { 39 if(a[i] == 0) 40 continue; 41 else 42 cout<<char(a[i]-1+65); 43 } 44 cout<<endl; 45 } 46 }