争夺前五名题解
争夺前五名
http://www.nowcoder.com/questionTerminal/cd052308a1c44a88ad00255f312c3e14
这题真的很水(bushi)只要输入、sort排序、输出就可以了
#include<bits/stdc++.h> using namespace std; bool comp(int x,int y){//重载sort return x > y; } int n; int a[99999]; int main(){ scanf("%d",&n); for(int i = 0;i < n;i ++) scanf("%d",&a[i]);//输入 sort(a,a+n,comp);//排序 for(int i = 0;i < 5;i ++) printf("%d ",a[i]);//输出 }