Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

又WA,哪位大牛帮帮忙啊

Posted by fangjing at 2007-08-27 11:46:18 on Problem 3253
#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);
    
   }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator