Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int t,i,j,a,b;
- char c;
- for(i=0;i<t;i++)
- {
- scanf("%d %d %c",&a,&b,&c);
- int ct[200];
- for(j=0;j<200;j++)
- {ct[j]=0;}
- for(j=0;j<a;j++)
- {
- int x;
- scanf("%d",&x);
- ct[x]++;
- }
- for(j=0;j<b;j++)
- {
- int x;
- scanf("%d",&x);
- ct[x]++;
- }
- int k=0,num[200];
- if(c=='U')
- {
- for(j=0;j<200;j++)
- if(ct[j]!=0){
- num[k++]=j;
- }
- }
- else
- {
- for(j=0;j<200;j++)
- if(ct[j]>0){
- num[k++]=j;
- }
- }
- printf("case#1:\n",i);
- for(j=0;j<k;j++)
- {
- printf("%d",num[j]);
- if(j=k-1)
- printf("\n");
- else
- printf(" ");
- }
- }
- }
Add Comment
Please, Sign In to add comment