Competitive Coding Course
Introduction
1.Space Mission
Mr. Code Stark went on a space mission and landed on Planet X which uses a different number
system.
Instead of having the least significant digit on the extreme right, they have the least significant digit
on the extreme left.
So, 321 on our planet is 123 on the Planet X.
Mr. Code Stark wanted to find numbers that are same on both the planet Earth and Planet X. Help
him find such numbers.
Input Format:
One line containing the integer
Output Format:
True - If the number is same on Planet X.
False - If the number is different on Planet X.
Constraints:
1 ≤ number ≤ 10^19
Sample Input-1:
123
Sample Output-1:
False
Explanation:
On Planet X, the number 123 will be written as 321 so the output is False.
Sample Input-2:
121
Sample Output-2:
True
Explanation:
On Planet X, the number 121 will be written as 121 so the output is True.
2.Converting Numbers to Roman Numerals
Mr. Code Stark was surprised to hear about the Roman numerals. The Roman numerals are
represented by seven different symbols: I, V, X, L, C, D and M each representing a value as shown
below. These symbols are connected together to represent any number.
Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example,
2 is written as II in Roman numeral, just two one's added together.
12 is written as XII, which is simply X + II.
The number 27 is written as XXVII, which is XX + V + II.
Roman numerals are usually written largest to smallest from left to right. However, the numeral for
four is not IIII. Instead, the number four is written as IV. Because the one is before the five we
subtract it making four. The same principle applies to the number nine, which is written as IX. There
are six instances where subtraction is used:
I can be placed before V (5) and X (10) to make 4 and 9.
X can be placed before L (50) and C (100) to make 40 and 90.
C can be placed before D (500) and M (1000) to make 400 and 900.
Now Help Mr. Code Stark write the logic to convert a given number to roman numeral.
Input Format:
One line containing the integer number
Output Format:
The roman numeral for the integer given in the input.
Sample Input-1:
14
Sample Output-1:
XIV
Explanation:
The roman literal for the number 14 is XIV.