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

哪位大牛能解释一下GCC,G++,C,C++有什么不同?

Posted by primelb at 2007-09-19 01:35:35 on Problem 2231
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
    int p[10001],n,i,j;
    __int64 sum;
    while(scanf("%d",&n)!=EOF){
    for(i=0;i<n;i++)
    scanf("%d",&p[i]);
    sum=0;
    for(i=0;i<n;i++)
    for(j=i+1;j<n;j++)
    sum+=abs(p[i]-p[j]);
    sum=sum<<1;
    printf("%I64d\n",sum);
    }
   return 0;
}

同样是这个代码,GCC,G++都AC,C,C++却TLE,为什么啊?

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