| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
werte#include <stdio.h>
#include <iostream.h>
void main(){
long int x[50000]={0},n,i,k,j,d[50000]={0},tem=0,t=0;
cin>>n;
for(i=0;i<n-1;i++)
cin>>x[i];
if(n==2){
cout<<x[0]<<endl;
cout<<"2"<<"1"<<endl;
}
for(j=1;j<n-2;j++)
d[j-1]=x[j]-x[j-1];
for(j=0;j<n-4;j++){
for(k=0;k<n-4-j;k++){
if(d[k]>d[k+1]){
tem=d[k];
d[k]=d[k+1];
d[k+1]=tem;
t=k;
}
}
}
cout<<d[0]+x[n-2]<<endl;
cout<<t+3<<" "<<"1"<<" "<<n<<" "<<t+2<<endl;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator