Problem 1: Digital Magnification
Given a sequence of integers and a magnification factor x, each integer in the sequence is magnified x times and output.
Time limit: 1000
Memory limit: 65536
The input
consists of three lines: The first line is N, indicating the length of the integer sequence (N ≤ 100); the second line is N integers (not exceeding the integer range), and the integers are separated by a space ; The third line contains an integer (not exceeding the integer range), which is the specified integer x.
Output
N integers, which are the enlarged sequence of the original sequence, and the integers are separated by a space.
Sample input
3
1 5 7
2
Sample output
2 10 14
The idea of solving the problem is as follows:
(1) First, we need to read the length N of the input integer sequence, as well as N integers and the magnification x. This can be scanf
achieved using a function that reads the input using the appropriate format specifier as required by the topic.
(2) Next, we need to traverse the sequence of integers, multiply each integer by x times and output it. You can use a loop to iterate over the sequence of integers, and use printf
a function to output the enlarged integers.
(3) In the loop, we can use the multiplication operation to magnify each integer by x times. After outputting the enlarged integer, output a space.
<