1148:0 start-up algorithm 55--print all points below the average score

Source: Internet
Author: User

1148:0 start-up algorithm 55--print all points below average time limit:1 Sec Memory limit:64 MB 64bit IO Format:%lld
submitted:2456 accepted:777
[Submit] [Status] [Web Board] Description

Enter n scores to print out all points below the average score (Note: Ave = S/n is float or ave = (float) n/a).

Input

Multiple test data
Each test data row, in this line first enter the number of fractions N (1<=n<=100), and then followed by the input n integers (representing fractions)

Output

For each test data, the output line outputs all points below the (<) average score in the input order, separated by a space, and if there is no lower than average, only one blank line is output

Sample Input
3 40 50 602 90 804 10 10 90 80

Sample Output
408010 10

Source

0 Starting point Learning algorithm

1#include <stdio.h>2 intMain () {3     intn,a[ $],b[ $];4      while(SCANF ("%d", &n)! =EOF) {5         ints=0;6          for(intI=0; i<n;i++){7scanf"%d",&a[i]);8s+=A[i];9         }Ten         floatAve= (float) s/N; One         intj=0; A          for(intI=0; i<n;i++){ -             if(a[i]<Ave) { -b[j]=A[i]; theJ + +; -             } -         } -         if(j==0) +printf"\ n"); -         Else{ +              for(intI=0; i<j-1; i++){ Aprintf"%d", B[i]); at             } -printf"%d\n", b[j-1]); -         } -     } -     return 0; -}

1148:0 start-up algorithm 55--print all points below the average score

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.