1296 - I2P_2017_EECS_HW3 Scoreboard

Time

2017/10/11 10:00:00 2017/10/18 08:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
10097 decimal to ternary
11126 Binary representation
11598 Word rotation

10097 - decimal to ternary   

Description

Input two positive integers, X and Y. The task is to translate the decimal number X into Y digits ternary (三進位) number, and output the Y digits ternary number.

X is smaller than 1000 and Y is smaller than 8.

Input

 Two positive integers, X and Y.  X is smaller than 1000 and Y is smaller than 8.

 

Output

The Y digits ternary representation of the input number X.

Note that you need to print a '\n' at the end of the bit string.

 

Sample Input  Download

Sample Output  Download

Tags

10401HW3



Discuss




11126 - Binary representation   

Description

Consider the following program:

#include 
#include 
int main(void)
{
    char str[65] = {0};
    int bit[65];
    int i, n;
    unsigned long long x;

    scanf("%64s", str); /* read the input bit string */ 
    n = strlen(str);    /* get the length of the string */
    i = 0;
    x = 0;
    while ...
    ...

If the input string is 1101, the program will print 13. If the input is 100000000000000000000000000000000000001, the output should be 274877906945. Now, your task is to modify the program so that it can do the opposite. That is, given a non-negative decimal number, print its binary representation. For example, if the input is 14, the output should be 1110.

Input

An integer that can be read by scanf using the format "%llu" and can be stored in a variable of type unsigned long long

Output

The binary representation of the input number. Note that you need to print a '\n' at the end of the bit string.

Sample Input  Download

Sample Output  Download

Tags




Discuss




11598 - Word rotation   

Description

    Given a string with length L < 1001 and only containing capital letters, lower letters and digits, please output the result of rotating the word for one time, and repeat doing so for L times.

    Suppose the original string is  ab1cde , after rotating for one time, the result will be  b1cdea. 

That is, the operator of rotating for one time is to move the first letter of the string to the tail of the string. 

 

Input

There is only one line in the input, which is a string only containing capital letters, lower letters and digits.

The length of the string L < 1001.

 

Output

    Output the result of rotating the word for one time, and repeat doing so for L times. The last line is the original string. Remember to print the endline character.

Sample Input  Download

Sample Output  Download

Tags




Discuss