| ||||||||||
| 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 | |||||||||
该程序运行时说是“不能written”,苦也苦也!!!In Reply To:改动之后仍是error,郁闷郁闷!!!! Posted by:90401304 at 2004-12-22 21:23:44 #include <stdio.h>
#include <malloc.h>
void main(){
long int N,i,k,j,*sp,time=0,*tem=0;
scanf("%d",&N);
sp=(long int *)malloc(sizeof(long int)*N);
for(i=0;i<N;i++)
scanf("%ld",sp++);
if(N==1){
time=*sp;
printf("%ld\n",time);
}
else{
for(j=0;j<N-1;j++){
for(k=0;k<N-j;k++){
if(*(sp+k)<*(sp+k+1)){
*tem=*(sp+k);
*(sp+k)=*(sp+k+1);
*(sp+k+1)=*tem;
}
}
}
for(i=0;i<N-2;i++)
time=time+*(sp+i);
time=time+(int)(N/2-1)*(*(sp+1)+*sp);
printf("%ld\n",time);
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator