2019 C language programming freshmen's first competition problem solutions

2019 C language programming freshmen's first competition problem solutions

1. You can really dance
is very simple, violent output! This question is better than hand speed!
2. Do you want AK?
If you want to do this problem, you must understand the symbol of'summing';
Insert picture description here

It means: i=1, n+k is the number of sums required, that is, add from 1 to (n+k) times, and then multiply the result by 3 and output.
3. Huihui Takes Scholarship This
question is actually very simple.
Define an array a[25000], the capacity depends on the topic requirements; input Huihui’s grades and the grades of other n students in the class into the array, and then bubble sort, sort from largest to smallest, and then judge Hui Huihui score (q) is compared with the score of the mth individual (ie a[m-1]). If a[m-1] is not smaller, Huihui score will output "YES" in the top m; otherwise, output "NO" , After that, take the top m score and output it. Pay attention to whether there is any repetition of the score of the mth place. 88 points, all output!), output all together!

4. Tonight, eat chicken in the desert is
optimistic about the format; assuming that each station is filled with gas, once the distance between two gas stations exceeds the capacity of the gas tank, that is, the next gas station cannot be reached, which means “if the distance between two adjacent gas stations is If the distance (a[ i+1 ]-a[ i ]) is greater than the fuel tank capacity (V), it will output'-1'.” Define an array a 1000 , first use a for() loop to assign values ​​to the array, and give a for() loop, Make the comparison in the array to calculate whether the distance between the two gas stations is greater than the tank capacity, as shown in the figure:
Insert picture description here

Here b represents whether it can reach the end point. If the distance is greater than the capacity, it is -1 and output; otherwise, b is still 0, which means that it can be reached finally, then the minimum refueling amount is the distance from the first gas station to the last gas station Distance (a[n-1]-a[0]) (gasoline).
5. Kaikai playing chess pieces.
From the title, (x1, y1) is in the lower right corner (x2, y2) is in the lower right corner. Think of him as a two-dimensional axis, as shown in the figure:
Insert picture description here
simple and clear, the other is to pay attention to multiple sets of input and output Output format.
6. A+B(V)
Insert picture description here
This is the translated title. It's very simple. Just sum it up.
The ACM competition won't be translated by computers. They use their own dictionaries to look up them. So, boy, remember the words!

Guess you like

Origin blog.csdn.net/diviner_s/article/details/103134332