Huawei Machine test-talent show rating

Source: Internet
Author: User

Title: Talent Show Rating

Talent show score, divided into expert judges and the public judges, score[] array to store each judge scored points, judge_type[] score[] array corresponding to the jury category, judge_type[i] = = 1, representing the expert judges; Judge_type[i] = = 2, representing the public jury, n represents the total number of judges.


The scoring rules are as follows:

the scores of the expert judges and the public judges were first divided by an average (average sub-rounding), then, the total score = The expert Judges average divided *0.6 + the general jury *0.4, total score rounding.

If there is no mass jury, then the total score = Expert Judges, the total score rounding. The function eventually returns the player's score.


function interface int Cal_score (int score[], int judge_type[], int n)


#include <iostream>using namespace Std;int cal_score (int score[], int judge_type[], int n) {    int jcnt1=0;    int jcnt2=0;    int sum1=0;    int sum2=0;    int result;    for (int i=0;i<n;++i)    {        if (judge_type[i]==1)            jcnt1++,sum1+=score[i];        if (judge_type[i]==2)            jcnt2++,sum2+=score[i];    }    if (jcnt2==0)    {        result=sum1/jcnt1;    }    else    {        result=sum1*1.0/jcnt1*0.6+sum2*1.0/jcnt2*0.4;    }    return result;} int main (int argc, char *argv[]) {    int n = ten;    int score[10] = {80,85,90,80,75,95,80,90,95,92};    int judge_type[10] = {1,1,1,1,1,1,2,2,2,2};    cout << Cal_score (score,judge_type,n) << Endl;    return 0;}



Huawei Machine test-talent show rating

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.