using namespace std;
long long gcd(long long x, long long y)
{
if (x == 0)
return y;
if (y == 0)
return x;
while (y != 0)
{
long long tmp = y;
y = x % y;
x = tmp;
}
return x;
}
int main()
{
int N, X;
long long a, b, GCD;
long long diceP[11][71], total[11] = { 0 };
for (int i = 0; i < 11; i++)
for (int j = 0; j < 71; j++)
diceP[i][j] = 0;
diceP[0][0] = 1;
total[0] = 1;
for (int i = 1; i <= 10; i++)
{
for (int j = 6 * i; j >= i; j--)
{
for (int k = 1; k <= 6 && j - k >= 0; k++)
diceP[i][j] += diceP[i - 1][j - k];
}
total[i] = total[i - 1] * 6;
}
for (int i = 1; i <= 10; i++)
{
for (int j = 6 * i; j >= 0; j--)
diceP[i][j] += diceP[i][j + 1];
}
while (cin >> N >> X)
{
if (N == 0 && X == 0)
break;
a = diceP[N][X];
b = total[N];
GCD = gcd(a, b);
a /= GCD;
b /= GCD;
if (b == 1)
cout << a << endl;
else
cout << a << "/" << b << endl;
}
return 0;
}
沒有留言:
張貼留言