1529 - I2P (I) 2018_Yang_Lab2_補考 Scoreboard

Time

2018/10/17 19:00:00 2018/10/17 20:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
10579 Binary Addition
10768 wave
12013 multiplication

10579 - Binary Addition   

Description

Please compute the sum of two given n-bit binary numbers.

Input

The first line of the input file contains a positive integer t indicating the number of test cases. The first line of each test case is a positive integer n denoting the length of bits. The second and third lines are the two n-bit binary numbers. The first bit of each binary number is always 0, which guarantees that the sum of the two binary numbers can still be expressed as an n-bit binary number.

Case1 : t<=100, n<=100
Case2 : t<=200, n<=1000
Case3 : t<=300, n<=5000
Case4 : t<=400, n<=10000

Output

For each test case, your program should print the sum in the same format as the binary numbers given in input.

Sample Input  Download

Sample Output  Download

Tags




Discuss




10768 - wave   

Description

A character wave consistss of lines of characters, which has a parameter, length L.  The number of characters in the first line is 1, and is increased by one in the every following lines.  After the number of character reaches L, it starts to descrease until the number of characters become 1 again.  For example, the following is a character wave of length 3.

#

##

###

##

#   

Print out N character waves consequtively.  Each wave is built by the character C and the length is L.
 

Input

There are three inputs, separated by a space.  The first one is a character C; the second one and the third one are integers, specifying the length L and the number of waves N to print.
 

Output

Print out N waves consisting of character C and of length L.
Note that you do not need to print ‘\n’ at the end of the output.

Sample Input  Download

Sample Output  Download

Tags

10401Contest



Discuss




12013 - multiplication   

Description

Cookie multiplication

Jane has two types of cookies (of number N and M, respectively), and she uses a magic spell to produce more cookies (N * M in total).

However, there are many cookies. Jane asks you to help her calculate the number of new cookies she can make.

Input

3 integers K, N, M in order.

N , M means the number of cookies.

If the digits of new cookies is smaller than K,

please left pad with zeros up to K digits.

Data range:

0 <= N, M <= 2^32-1

1 <= K <= 1000000

Output

Output a single line with the number N * M, and a '\n' at the end.

Hint: overflow , printf skill

 

The * Modifier with printf() and scanf()

printf()

Suppose that you don't want to commit yourself to a field width in advance but rather you want
the program to specify it. You can do this by using * instead of a number for the field width, but
you also have to use an argument to tell what the field width should be. That is, if you have the
conversion specifier %*d, the argument list should include a value for * and a value for d. The
technique also can be used with floating-point values to specify the precision as well as the field
width. 
// uses variable-width output field
#include <stdio.h>
int main(void)
{
    unsigned width, precision;
    int number = 256;
    double weight = 242.5;
    printf("What field width?\n");
    scanf("%d", &width);
    printf("The number is :%*d:\n", width, number);
    printf("Now enter a width and a precision:\n");
    scanf("%d %d", &width, &precision);
    printf("Weight = %*.*f\n", width, precision, weight);
    printf("Done!\n");
    return 0;
}
-------------------------------------------------------------------------------------------------------------------------------
Sample run
What field width?
6
The number is :   256:
Now enter a width and a precision:
8 3
Weight =  242.500
Done!
 
scanf()
 
The * serves quite a different purpose for scanf(). When placed between the % and the specifier
letter, it causes that function to skip over corresponding input.
This skipping facility is useful if, for example, a program needs to read a particular column of a
file that has data arranged in uniform columns.
// skips over first two integers of input
#include <stdio.h>
int main(void)
{
    int n;
    printf("Please enter three integers:\n");
    scanf("%*d %*d %d", &n);
    printf("The last integer was %d\n", n);
    return 0;
}
-------------------------------------------------------------------------------------------------------------------------------
Sample run
Please enter three integers:
2004 2005 2006
The last integer was 2006


If you don't know how to search more information, you can look at this reference.

It really helps.

http://www.cplusplus.com/reference/cstdio/printf

Sample Input  Download

Sample Output  Download

Tags




Discuss