| ||||||||||
| 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 | |||||||||
Why WA here? Submit onto zju i got AC?//zju2433 Highways
//2006-9-26 16:37
#include "iostream"
using namespace std;
int main()
{
int cas;
bool start = true;
scanf( "%d", &cas );
while( cas -- )
{
int n;
scanf( "%d", &n );
int min = 1000000000;
int num;
int pre;
int index;
if( start == false )
printf( "\n" );
start = false;
if( n == 2 || n == 3 )
{
for( int i = 0 ; i < n - 1 ; i ++ )
scanf( "%ld", &num );
printf( "0\n" );
}
else
{
pre = 0;
for( int i = 0 ; i < n - 1 ; i ++ )
{
scanf( "%ld", &num );
if( num - pre < min && i != n -2 && i != 0 )
{
min = num - pre;
index = i;
}
pre = num;
}
printf( "%ld\n", min + num );
printf( "%d 1 %d %d\n", n, index + 2, index + 1 );
//printf( "%d 1 %d %d\n", index + 2, n, index + 1 );
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator