Huawei trial (6)

Source: Internet
Author: User

Preliminary questions
Description: After the assessment of the final exam for 10 students, instructor a needs to draw a pass. The requirements are as follows:
(1) the pass line is a multiple of 10;
(2) ensure that at least 60% of students pass the course;
(3) if all the students score higher than 60, the pass rate is 60.
(4) The higher the pass line, the better, but the maximum length cannot exceed 60
Input: enter 10 integers; values: 0 ~ 100
Output: the output pass, a multiple of 10.
Input example: 61 51 49 30 20 10 70 80 90 99
Output sample: 50

Solution: from high to low enumeration pass lines, the first pass line that meets the requirements is the answer.

# Include <iostream> # include <vector> using namespace STD; void main () {vector <int> VES (10, 0); For (INT I = 0; I <10; I ++) CIN> ves [I]; int res, num; // pass res, num passing person for (RES = 60; Res> = 0; res-= 10) {num = 0; For (INT I = 0; I <10; I ++) {If (VES [I]> = res) num ++;} If (Num >=6) {cout <res <Endl; break ;}}}

 

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.