Nayeemzaman

pcontest

Nov 5th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int t,i,j,a,b;
  5. char c;
  6. for(i=0;i<t;i++)
  7. {
  8. scanf("%d %d %c",&a,&b,&c);
  9. int ct[200];
  10. for(j=0;j<200;j++)
  11. {ct[j]=0;}
  12. for(j=0;j<a;j++)
  13. {
  14. int x;
  15. scanf("%d",&x);
  16. ct[x]++;
  17. }
  18. for(j=0;j<b;j++)
  19. {
  20. int x;
  21. scanf("%d",&x);
  22. ct[x]++;
  23. }
  24. int k=0,num[200];
  25. if(c=='U')
  26. {
  27. for(j=0;j<200;j++)
  28. if(ct[j]!=0){
  29. num[k++]=j;
  30. }
  31. }
  32. else
  33. {
  34. for(j=0;j<200;j++)
  35. if(ct[j]>0){
  36. num[k++]=j;
  37. }
  38. }
  39. printf("case#1:\n",i);
  40. for(j=0;j<k;j++)
  41. {
  42. printf("%d",num[j]);
  43. if(j=k-1)
  44. printf("\n");
  45. else
  46. printf(" ");
  47. }
  48. }
  49. }
Add Comment
Please, Sign In to add comment