标签:des style blog http color io os java ar
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 10666 Accepted Submission(s):
3720
#include<iostream> #include<cstring> #include<algorithm> #include<cstdio> using namespace std; int b[5000000]; int cmp(int x,int y) { return x>y; } int main() { int i,j,a[10000],n,m; while(~scanf("%d%d",&n,&m)) { memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); for(i=0;i<n;i++) scanf("%d",&a[i]); int r=0; for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { b[r++]=a[i]+a[j]; } } sort(b,b+r,cmp); printf("%d",b[0]); for(i=1;i<m;i++) printf(" %d",b[i]); printf("\n"); } return 0; }
标签:des style blog http color io os java ar
原文地址:http://www.cnblogs.com/cancangood/p/3966862.html