标签:
#include<stdio.h> int max(int a,int b) { int c; if(a>b) c=a; else c=b; return c; } int main() { FILE *fin,*fout; int a[8][8],i,j; fin=fopen("in.txt","r"); fout=fopen("out.txt","w"); for(i=0;i<=5;i++) for(j=0;j<=5;j++) a[i][j]=0; for(i=0;i<=4;i++) for(j=0;j<=i;j++) fscanf(fin,"%d",&a[i][j]); for(;i>=0;i--) for(j=0;j<=i;j++) a[i][j]=max(a[i-1][j],a[i-1][j+1]); fprintf(fout,"%d\n",a[0][0]); fclose(fin); fclose(fout); getchar(); getchar(); return 0; }
标签:
原文地址:http://www.cnblogs.com/QuantumGhost/p/5869372.html