首页 > 代码库 > 免费焰饼

免费焰饼

技术分享
#include<stdio.h>#include<string.h>int max(int a,int b){    return a>b?a:b;}int bei[12][100003];int main(){    int m,i,j;    //freopen("in.txt","r",stdin);    while( scanf("%d",&m)&&m)    {        int a,b,T=0;        memset(bei,0,sizeof(bei));        while(m--)        {            scanf("%d%d",&a,&b);            bei[a][b]++;  //时间为b,,位移为a;            T<b?T=b:b;  //选出最大时间;        }        for(j=0; j<11; j++)        for(i=T-1; i>=0; i--)            {                if(j==0)                    bei[j][i]+=max(bei[ j+1][i],bei[j+1][i+1]);                else                    bei[j][i]+=max(max(bei[j+1][i],bei[j+1][i+1]),bei[j+1][i-1]);            }        printf("%d\n",bei[5][0]);    }    return 0;}
View Code

 

免费焰饼