Editorial for DMOPC '18 Contest 3 P0 - Bob and ICS Class

Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.

Authors: Kirito

For this problem, we are given two triples of nonnegative integers and and we wish to determine if the tuples and are identical.

Most programming languages have a function that takes in a nonnegative number and outputs the square root of that number as a floating-point number. Similarly, most languages will allow you to cast that floating-point number to an integer which will remove the decimal part of the number.

Therefore, to check if and will be the same, we can compute (int)sqrt(x_1) and (int)sqrt(x_2) and see if they are equal, and repeat this for each of the other pairs of numbers that we need to compare.