| ||||||||||
| 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:哪里不对了 请帮忙 谢谢In Reply To:Re:哪里不对了 请帮忙 谢谢 Posted by:gucun4848 at 2008-07-20 10:20:59 #include<stdio.h>
int main()
{
int n,m,i,j,k,sum=0,temp=0;
int *a;
scanf("%d%d",&n,&m);
a=(int *)malloc(n*sizeof(int));
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
scanf("%d",&a[j]);
for(j=1;j<m;j++)
{
for(k=1;k<m;k++)
{
if(a[k]<a[k+1])
{
temp=a[k];
a[k]=a[k+1];
a[k+1]=temp;
}
}
}
for(j=1;j<=m;j++)
if(j%3==0)
sum=sum+a[j];
printf("%d\n",sum);
sum=0 ; }
scanf("%d",&m);
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator