- محدودیت زمان: ۱ ثانیه
- محدودیت حافظه: ۲۵۶ مگابایت
- Good. You got that too.
- Beats like digits. Every beat is a one, every rest is a zero. Binary code. That's why all those assassins tried to save my life. It was hidden on me, hidden inside my head. A few simple lines of computer code that can break into any system.
- Told all my clients, last one to Sherlock is a sissy.
- I can kill Rich Brook and bring back Jim Moriarty.”
Shamir0xe, believes in binary numbers. After lots of sleepless nights, he managed to crack Moriarty’s magical binary number to help Sherlock beat Moriarty. He realized it’s not a unique number, every number that follows at least two of the following rules, is a magical binary number:
- number is palindrome in decimal presentation
- number is palindrome in hexadecimal presentation
- number is palindrome in binary presentation
a word, phrase, or sequence that reads the same backward as forward, e.g., madam or nurses run. ex: “abcba” is palindrome while “abcca” is not.
Your job is to help sherlock determine if a number is a magical binary number or not.
ورودی
The first line of input shows the number of test cases $T$. $$ 1 \leq T \leq 100$$
Each of following $T$ lines contains an integer $N$. $$1 \leq N \leq 1000$$
خروجی
For each test case, if the number is a magical binary number print Magical
, otherwise print I’m sorry Sherlock :(
.
مثالها
ورودی نمونه ۱
3
85
17
12
خروجی نمونه ۱
Magical
Magical
I'm sorry Sherlock :(
In the first test case:
- $85 = (1010101)_2 \to \text{Palindrome}$
- $85 = (55)_{16} \to \text{Palindrome}$
ارسال پاسخ برای این سؤال