hdu 4786 Fibonacci Tree (最小生成樹擴展)
///白邊優先和黑邊優先做兩次最小生成樹
///若有斐波那契樹在這中間為yes
# include
# include
# include
# include
# include
using namespace std;
struct node
{
int x;
int y;
int v;
};
struct node a[100010];
int father[100010];
bool cmp1(node a1,node a2)
{
return a1.va2.v;
}
int find(int x)
{
if(father[x]==-1)
return x;
return father[x]=find(father[x]);
}
int main()
{
int i,t,n,m,num;
int cas=0;
int f[30];
f[1]=1;
f[2]=2;
for(num=3;; num++)
{
f[num]=f[num-1]+f[num-2];
if(f[num]>100010)
break;
}
while(~scanf("%d",&t))
{
while(t--)
{
scanf("%d%d",&n,&m);
for(i=0; i=min1&&f[i]<=max1)
{
flag=1;
break;
}
}
if(flag)
printf("Case #%d: Yes\n",++cas);
else
printf("Case #%d: No\n",++cas);
}
}
}
return 0;
}