📜  门| GATE-CS-2015(Set 2)|问题9

📅  最后修改于: 2021-07-02 16:48:43             🧑  作者: Mango

If p, q, r, s are distinct integers such that:
f(p, q, r, s) = max (p, q, r, s)
g(p, q, r, s) = min (p, q, r, s)
h(p, q, r, s) = remainder of (p × q) / (r × s)  if (p × q) > (r × s) OR 
                remainder of (r × s) / (p × q) if (r × s) > (p × q)
Also a function fgh (p, q, r, s) =
                f(p, q, r, s) × g(p, q, r, s) × h(p, q, r, s).
Also the same operation are valid with two variable functions 
of the form f(p, q).

What is the value of fg(h(2, 5, 7, 3), 4, 6, 8)? 

(A) 6
(B) 7
(C) 8
(D) 9答案: (C)
解释:

The question asks value of fg (h(2, 5, 7, 3), 4, 6, 8)

We need to first find value of h(2, 5, 7, 3) 

h is defined as 
h(p, q, r, s) = remainder of (p × q) / (r × s)  if (p × q) > (r × s)
                remainder of (r × s) / (r × q)  if (r × s) > (p × q)

h(2, 5, 7, 3) = remainder of (7 * 3) / (2 * 5)  since 7*3 > 2*5
              = 1

fg(1, 4, 6, 8) = f(1, 4, 6, 8) * g(1, 4, 6, 8)
               = max(1, 4, 6, 8) * min(1, 4, 6, 8)
               = 8 * 1
               = 8

这个问题的测验