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

Re:哪里不对了 请帮忙 谢谢

Posted by 7497101 at 2008-07-22 17:25:09 on Problem 3637
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:
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