Untitled

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
1.3 kB
0
Indexable
Never
#include <iostream>
#include <math.h>
#include <string>

int main() {
    
    int N,count = 0;
    std::string marks;
    long long sum = 0;
    double mean;

    std::cin >> N;
    std::cin >> marks;
    for (int i = 0; i < marks.length(); i++) {
        switch (marks[i])
        {
        case '5': {
            sum += 5;
            count += 1; 
            break;
        }case '4': {
            sum += 4;
            count += 1;
            break;
        }case '3': {
            sum += 3;
            count += 1;
            break;
        }case '2': {
            sum += 2;
            count += 1;
            break;
        }case '1': {
            sum += 1;
            count += 1;
            break;
        }default:
            std::cout << "Indees" << "\n";
            break;
        }
    }
    mean = float(sum) / float(count);

    if (mean - int(mean) >= 0.5) {
        mean = mean - (mean - int(mean)) + 1;
    }
    else {
        mean = mean - (mean - int(mean));
    }

    if (mean == 5) {
        std::cout << "Zadrot";
    }
    else if (mean == 4) {
        std::cout << "Zadrot po menshe";
    }
    else if (mean == 3) {
        std::cout << "Norm kent";
    }
    else if (mean == 2) {
        std::cout << "Bro non on no";
    }
}
Leave a Comment