Advertisement
Guest User

s

a guest
Oct 6th, 2015
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. Dhonis Bowlers
  2. Add problem to Todo list
  3. Problem code: AMR14C
  4.  
  5.  
  6. ALL SUBMISSIONS
  7. The Indian team is known for their strong batting and sloppy bowling. The captain M.S. Dhoni is concerned about this issue. He wants to address this by pairing up bowlers who have good economy rates.
  8. He has all the bowlers' economy rates as integers. Unfortunately, these are T20 figures and to convert them to ODI format, he wants to pair up bowlers in such a way that the sum of the economy rates of two bowlers, modulo M, is always less than or equal to X.
  9. Given the economy rates, M and X, can you tell him how many such ordered pairs are possible?
  10. Note: The pair of bowlers chosen by him can be the same. Yeah, Dhoni has won a cup in all limited over formats, but he definitely needs to sharpen his math skills.
  11. Input:
  12. The first line contains the number of test cases T. Each test case contains N, M and X on the first line, followed by N space separated integers A[1..N] on the second line.
  13. Output:
  14. Output T lines, containing the answer for the corresponding test case.
  15. Constraints:
  16. 1 <= T <= 10
  17. 1 <= N <= 100000
  18. 0 <= X < M <= 100000
  19. 0 <= A[i] <= 1000000000
  20. Sample Input:
  21. 2
  22. 3 5 3
  23. 1 2 3
  24. 4 7 4
  25. 31 12 11 17
  26. Sample Output:
  27. 6
  28. 12
  29. Explanation:
  30. For the first example, the valid pairs are (1, 1), (1, 2), (2, 1), (2, 3), (3, 2), (3, 3).
  31.  
  32.  
  33. Author: murdocc007
  34. Date Added: 27-12-2014
  35. Time Limit: 1 sec
  36. Source Limit: 50000 Bytes
  37. Languages: ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.9.2, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement