HDU5914 Triangle (找规律)

题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=5914


题目大意:有长度分别为1到n的n根棒子,求最少偷走多少根棒子使得任意三根棒子不能组成三角形。


解题思路:本菜鸡手推,反正n<=20……







#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
#define showtime fprintf(stderr,"time = %.15f\n",clock() / (double)CLOCKS_PER_SEC)
#define lld %I64d
#define REP(i,k,n) for(int i=k;i'9'; ch=getchar());for(; ch>='0'&&ch<='9'; ch=getchar())s=s*10+ch-'0';return s;}


int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int a[21] = {0,0,0,0,1,1,2,3,3,4,5,6,7,7,8,9,10,11,12,13,14};
    int t;
    int cas=1;
    scan(t);
    while(t--)
    {
        int n;
        scan(n);
        printf("Case #%d: %d\n",cas++,a[n]);
    }


    return 0;
}


你可能感兴趣的:(~~~~~acm~~~~~,没有神马是暴力解决不了的)