Shape A能够打败Shape B 就连一条A到B的线,要让获胜概率为一半,则能够打败A的和A能够打败的要相等,设两个的数量分别为x 则一共有1+2x
则概率为x/(1+2x)+1/(1+2x)*x/(1+2x)+1/1(1+2x)/(1+2x)*x/(1+2x)……得1/2,这个概率的计算方法,在别的一些问题里也会碰到
实际上是连线的条数是无向图完全图的条数,但是这些条数带有方向,要保证一个点的入度和出度相等,奇数就可以了
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
#define ll long long
int t;
int n;
int main()
{
scanf("%d", &t);
while (t--)
{
scanf("%d", &n);
if (n & 1)
{
printf("Balanced\n");
}
else
{
printf("Bad\n");
}
}
return 0;
}