Data Structures & AlgorithmsVery hardCodeforces Div2 B-D · ICPC regional

How many ordered pairs (a, b) with 1 <= a, b <= 6 have a^2 + b^2 a perfect square?

  1. A. 2
  2. B. 3
  3. C. 1
  4. D. 6

Correct answer: A. 2

Check each of the 36 ordered pairs for a perfect-square sum; for example (3,4) and (4,3) both give 25, so ordered counting doubles unordered pairs.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic