Olympic Scores

Problem Link

Solution by Mr.Olimpia — 100 pts

Code / Notes

#include <bits/stdc++.h>
using namespace std;

// https://ide.usaco.guide/Ov5Bu8j7yJ_6itiOaT2

// P[3] = 5 -> o pai do 3 é o 5
// P[3] = -1 -> 3 não tem pai

int main() {
    int d;
    vector<int> s(5);
    cin >> s[0] >> s[1] >> s[2] >> s[3] >> s[4] >> d;
    int ansmax=0;
    int ansmin=s[0];
    for(int i=0; i<5; i++){
        ansmax= max(ansmax, s[i]);
        ansmin= min(ansmin, s[i]);
    }
    cout << (s[0] + s[1] + s[2] + s[3] + s[4]-ansmax-ansmin)*d;
}

Last updated 1 month, 3 weeks ago


« Back to problem