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 |
Re:又WA,哪位大牛帮帮忙啊In Reply To:又WA,哪位大牛帮帮忙啊 Posted by:fangjing at 2007-08-27 11:46:18 > #include<iostream> > #include<cstdio> > #include<algorithm> > #define SIZE 20001 > using namespace std; > > __int64 length[SIZE]; > > int main( void ) > { > int i; > long n; > __int64 sum=0; > __int64 money=0; > > cin>>n; > memset( length , 0, sizeof( length ) ); > > for ( i=0; i<n; i++ ) > { > scanf("%I64d",&length[i]); > sum += length[ i ]; > } > > sort( &length[0], &length[n-1] ); > > for ( i=n-1; i>=1; i-- ) > { > money+=sum; > sum-=length[i]; > } > > printf("%I64d\n",money); > > } 5 (6 7 8 9 10),104这样你就错了。。。 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator