HDU - 5914 - Triangle (规律)

链接:

http://acm.hdu.edu.cn/showproblem.php?pid=5914

题意:

1-n中取出最少的数使得任意三个都构不成三角形

思路:

1  2  3  5  8  13

#include 
using namespace std;

int a[100]={0,0,0,0,1,1,2,3,3,4,5,6,7,7,8,9,10,11,12,13,14,15};

int main()
{
    int t,n,cnt=0;
    scanf("%d",&t);
    while(t--){
        scanf("%d",&n);
        printf("Case #%d: %d\n",++cnt,a[n]);
    }
    return 0;
}

 

你可能感兴趣的:(ACM解题记录,思路)