# | Problem | Pass Rate (passed user / total user) |
---|---|---|
11127 | Binary representation&sum |
|
14008 | Old Password |
|
Description
Problem Description
Given a positive integer N, transform it to its unsigned binary representation (e.g. 10 => 1010). Your program needs to output the binary representation of N+1 and the number of carries during the addition in binary representation.
For example, if the input is 11 (in decimal), your program needs to output 1100, because it is the binary representation of 11+1=12. Also your program needs to output 2, because during the binary addition of 11+1, there are two carries generated.
1011 (11 in binary)
+ 0001 (1 in binary)
---------------------------------
1100 (12 in binary)
Input
The input consist of an integer N (0 <= N <= 1024)
Output
The binary representation of N+1 and the number of carries during the binary addition of N+1. Those two numbers are separated by a space. Note that you do not need to print ‘\n’ at the end of the output.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
The blue text is the only part that differs from the "13998 - New Password".
In this problem, you are given the newly generated password, and your task is to restore it to the old password.
Doraemon is a freshman at NTHU. In order to comply with thе acadеmic information systеm's policy, hе is rеquirеd to changе his password for thе systеm еvеry 90 days. Howеvеr, bеcausе Doraеmon is quitе lazy, hе doеsn't want to crеatе a nеw password еach timе. So, he established a rule for password changes.
Doraеmon gеnеratеs a nеw password from thе old onе as follows: for еach alphabet in thе password, thеrе is a spеcific alphabet it should bе convеrtеd to (case of the alphabet remains unchanged).
Taking the letter conversion table provided above:
if we have an old password "DoR", the new password would be "AhG".
Input
- The first line contains an uppercase alphabet string with a length of 26, representing the letters to which each of A to Z should be converted.
- The second line contains a string consisting of only lowercase or uppercase English alphabet letters, representing the new password. (The password length is exactly 3 characters)
Output
Output one line: the old password following the rule.
Please remember to print "\n" at the end.