标签:des style blog color java os io strong
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 10 Accepted Submission(s): 3
#include <stdio.h> #include <string.h> #include <algorithm> using namespace std; int main() { int t; int n; int i, j; int a[60]; int b[60], e; scanf("%d", &t); while(t--) { scanf("%d", &n); for(i=0; i<n; i++) { scanf("%d", &a[i] ); } sort(a, a+n); e=0; for(i=1; i<n; i++) { b[e++] = a[i] - a[i-1] ; } sort(b, b+n-1 ); int max=-1; int flag; for(i=0; i<n-1; i++) { flag=1; //初始化每个间距标记 for(j=1; j<n-1; j++) { if(a[j]-b[i]<a[j-1] && a[j]+b[i]>a[j+1] ) { flag=0; break; } } if(flag==1) { if(b[i] >max ) { max = b[i] ; } } } printf("%d", max ); printf(".000\n"); } return 0; }
BestCoder Round #4 之 Miaomiao's Geometry(2014/8/10),布布扣,bubuko.com
BestCoder Round #4 之 Miaomiao's Geometry(2014/8/10)
标签:des style blog color java os io strong
原文地址:http://www.cnblogs.com/yspworld/p/3903330.html