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

我的算法有问题?大牛们帮忙看下

Posted by ACFirst at 2010-04-10 14:16:36 on Problem 3230
#include<stdio.h>
#include<stdlib.h>
int main()
{
    int m,n,i,j,max,x;
    int day[100][100],city[100][100];
    while(scanf("%d%d",&n,&m)&&n&&m){
    x=0;
    int sum=0;
    for(i=0;i<n;i++)
    for(j=0;j<n;j++)scanf("%d",&city[i][j]);
    for(i=0;i<m;i++)
    for(j=0;j<n;j++)scanf("%d",&day[i][j]);
    for(i=0;i<m;i++){
        max=0;
        for(j=0;j<n;j++)
        if(max<(day[i][j]-city[x][j])){
        max=day[i][j]-city[x][j];
        x=j;}
        sum+=max;
        }
        printf("%d\n",sum);
        }
        system("pause");
        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