Advertisement
Guest User

Untitled

a guest
Nov 13th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. //3750
  2.  
  3. var
  4. a, b, c: set of longint;
  5. z, y, x: longint;
  6. f1: text;
  7.  
  8. begin
  9. assign(f1, 'input.txt');
  10. reset(f1);
  11. a := [];
  12. b := [];
  13. while not eoln(f1) do
  14. begin
  15. read(f1, x);
  16. include(a, x);
  17. end;
  18. readln(f1);
  19. while not eoln(f1) do
  20. begin
  21. read(f1, z);
  22. include(b, z);
  23. end;
  24. y := 0;
  25. c := a * b;
  26. foreach var l in c do
  27. y := y + 1;
  28. writeln(y);
  29. end.
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37. //3751
  38. var
  39. a, c, b: set of longint;
  40. y, l, x, i: integer;
  41. f1: text;
  42.  
  43. begin
  44. assign(f1, 'input.txt');
  45. reset(f1);
  46. a := [];
  47. b := [];
  48. while not eoln(f1) do
  49. begin
  50. read(f1, x);
  51. include(a, x);
  52. end;
  53. readln(f1);
  54. while not eoln(f1) do
  55. begin
  56. read(f1, y);
  57. include(b, y);
  58. end;
  59. l := 0;
  60. c := a * b;
  61. foreach var s in c do
  62. l := l + 1;
  63. for i := 1 to 100000 do
  64. if i in c then write(i, ' ');
  65. end.
  66.  
  67.  
  68.  
  69.  
  70.  
  71. //3453
  72.  
  73.  
  74. var
  75. a: set of longint;
  76. i, j, n, k, l, z: integer;
  77. s: string;
  78. f1: text;
  79.  
  80. begin
  81. z := 0;
  82. assign(f1, 'output.txt');
  83. rewrite(f1);
  84. a := [];
  85. readln(n);
  86. for i := 1 to n do
  87. begin
  88. readln(s);
  89. if (s[1] = 'A') then
  90. begin
  91. delete(s, 1, 4);
  92. val(s, k, l);
  93. if k in a then
  94. include(a, k)
  95. else
  96. begin
  97. include(a, k); z := z + 1;
  98. end;
  99. end;
  100. if (s[1] = 'P') then
  101. begin
  102. delete(s, 1, 8);
  103. val(s, k, l);
  104. if k in a then writeln(f1, 'YES')
  105. else writeln(f1, 'NO');
  106. end;
  107. if (s[1] = 'C') then
  108. begin
  109. writeln(f1, z);
  110. end;
  111. end;
  112. close(f1);
  113. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement