URAL 1260. Nudnik Photographer

虽然是简单递推 找规律 这种DP还是做得少 没有感觉

参考http://hi.baidu.com/xiaozhao_club/item/aec3d7c898d56d390831c6da

#include <cstdio>
__int64 a[60];
int main()
{
    a[1]=1;
    a[2]=1;
    a[3]=2;
    for(int i = 4; i <= 55; i++)
        a[i] = a[i-3] + a[i-1] + 1;
    int n;
    while(scanf("%d",&n) != EOF)
	{
        printf("%I64d\n",a[n]);
    }
    return 0;
}


 

你可能感兴趣的:(URAL 1260. Nudnik Photographer)