Rokua-Small fish than cute-array

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.