The russian intelligence agency KGB make an encryption technique to send their…
- User
The russian intelligence agency KGB make an encryption technique to send their passwords. Originally the password is of 3 characters. After encryption the password is converted into 3 numbers A-B-C.
Now, Sherlock wants to decrypt the password encryption technique of KGB. Sherlock knows that every number has only 2 possible values which are following:
POSSIBLE VALUES OF "A": K, X
POSSIBLE VALUES OF "B": G, Y
POSSIBLE VALUES OF "C": B, Z
Help Sherlock to detect the encryption technique of the KGB and tell him the original password. [See problem explanation for further clarifiaction] INPUT:
The first line consist number of test cases T followed by T lines, each line consist of 3 space separated integers A, B, C.
OUTPUT
Print the correct message in format of C-C-C
Constraints:
1 ≤ T ≤ 50000
1 ≤ A, B, C ≤ 1000000000
SAMPLE INPUT 2 27 25 4 25 26 16
SAMPLE OUTPUT K-G-B X-Y-B
Explanation
For test case 1, the password sent is 27-25-4, then 27 can be either 'K' or 'X', similar case for 25 & 4. After applying the encryption 27 is converted into K, 25 is converted into G and 4 is converted into B.
Assistant
pythondef is_cube(x): if x < 1: return False low = 1 high = 1000 while low <= high: mid = (low + high) // 2 cube = mid ** 3 if cube == x: return True elif cube < x: low = mid + 1 else: high = mid - 1 return False T = int(input()) for _ in range(T): A, B, C = map(int, input().split()) a_char = 'K' if is_cube(A) else 'X' b_char = 'Y' if B % 2 == 0 else 'G' c_char = 'B' if C % 2 == 0 else 'Z' print(f"{a_char}-{b_char}-{c_char}")
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.