NYOJ834组队

原题链接

#include 
#include 
#include 
using namespace std;
int main() {
    int n, i, j,a[55],b[4] ,*p;
    while(scanf("%d", &n) == 1) {
        for(i = 1; i <= n; ++i)
            scanf("%d", &a[i]);
        for(j = b[3] = 0; j < 3; ++j) {
            p = max_element(a + 1, a + n + 1);
            b[j] = p - a; b[3] += *p; *p = 0;
        }
        sort(b, b + 3);
        for(i = 0; i < 4; ++i)
            if(i == 3) printf("%d\n", b[3]);
            else printf("%d ", b[i]);
    }
    return 0;
}

1003413 hpu_yw 组队 Accepted 0 232 C/C++ 10-13 21:12:54

你可能感兴趣的:(NYOJ834组队)