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 |
我的算法有问题?大牛们帮忙看下#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator