Title DescriptionDescription People are more angry than men, and fish are more difficult to fish than fish. Little Fish recently participated in a "more than cute" game, compared to the loveliness of each fish. The fish are lined up from left to right, heads are facing to the left, and each fish gets an integer value that indicates how cute the fish is, and it is clear that the larger the whole number, the more adorable the fish, and the more adorable the two fish are. Since all the fish heads are facing to the left, each fish can only see the lovely degree of the fish on its left side, they are in the calculation of their own eyesight within the range of how many fish than their own lovely. Please count the small fish who are cute but have enough fish brains.
input/output format input/output
Input Format:
The first line enters an integer n, which indicates the number of fish.
Enter n integers in the second row, with a space interval, which in turn represents the loveliness of each small fish from left to right.
output Format:
In-line output n integers, with a space interval, in order to indicate how many fish in each small fish eye than their own cute.
input and Output sample sample Input/output
sample Test point # #
Input Sample:
6
4 3 0 5 1 2
Sample output:
0 0 0 3 1 2
Idea: This question is very simple, as long as from that fish start, sweep forward, there is a more cute than it + +.
The code is as follows:
1#include <stdio.h>2 intMain ()3 { 4 inta,i,j; 5 intag[ -],bk[ -]; 6scanf"%d",&a); 7 for(i=0; i<a;i++)//input, clear 08 { 9scanf"%d",&Ag[i]); Tenbk[i]=0; One } A for(i=1; i<a;i++)//Dual Cycle - for(j=0; j<i;j++)//loop back and forth, deposit BK array - if(Ag[j]<ag[i]) bk[i]++;//There's something cuter than it. the for(i=0; i<a;i++) printf ("%d", Bk[i]); -printf"\ n"); - return 0; -}
Rokua-Small fish than cute-array