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:为什么我的超内存啊,我都用邻接表了,还不行啊 Posted by:panning025 at 2012-07-20 19:33:25 #include<stdio.h> int m,n; int k[100],key; int g[100][3]; int s[100][100][2]; int min(int x) { int i,MIN=10001,mm; MIN=g[x][0]; mm=g[x][0]; for (i=0;i<g[x][2];i++) { if(k[s[x][i][0]-1]==1) { if(s[x][i][1]<mm) { mm=s[x][i][1]+min(s[x][i][0]-1); } } //printf("%d\n",mm); if(mm<MIN)MIN=mm; } return MIN; } int main() { int i,j; int mm; scanf("%d %d",&m,&n); scanf("%d %d %d",g[0],g[0]+1,g[0]+2); for (j=0;j<g[0][2];j++) { scanf("%d %d",s[0][j],s[0][j]+1); } key=g[0][1]; k[0]=1; for (i=1;i<n;i++) { scanf("%d %d %d",g[i],g[i]+1,g[i]+2); for (j=0;j<g[i][2];j++) { scanf("%d %d",s[i][j],s[i][j]+1); } if (key-g[i][1]<=m) k[i]=1; else k[i]=0; } mm=min(0); printf("%d\n",mm); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator