#include <stdio.h>
#define MAXN 24
#define MAXX 150
unsigned long long int dice[MAXN + 1][MAXX + 1];
void creat()
{
dice[1][1] = 1, dice[1][2] = 1, dice[1][3] = 1,
dice[1][4] = 1, dice[1][5] = 1, dice[1][6] = 1;
int i, j;
for (i = 2; i <= MAXN; i ++)
for (j = 2; j <= MAXX; j ++)
{
if (j - 6 >= i - 1) dice[i][j] += dice[i - 1][j - 6];
if (j - 5 >= i - 1) dice[i][j] += dice[i - 1][j - 5];
if (j - 4 >= i - 1) dice[i][j] += dice[i - 1][j - 4];
if (j - 3 >= i - 1) dice[i][j] += dice[i - 1][j - 3];
if (j - 2 >= i - 1) dice[i][j] += dice[i - 1][j - 2];
if (j - 1 >= i - 1) dice[i][j] += dice[i - 1][j - 1];
}
}
int main()
{
creat();
int i, j, n, x;
unsigned long long int total, d;
while (scanf("%d %d", &n, &x) == 2)
{
if (n == 0 && x == 0) break;
total = 0, d = 0;
for (i = 0; i <= MAXX; i ++ )
{
total += dice[n][i];
if (i >= x) d += dice[n][i];
}
while (total % 2 == 0 && d % 2 == 0)
total /= 2, d /= 2;
while (total % 3 == 0 && d % 3 == 0)
total /= 3, d /= 3;
if (d == 0) printf("0\n");
else if(d == total) printf("1\n");
else printf("%lld/%lld\n", d, total);
}
return 0;
}
回目錄
回首頁
沒有留言 :
張貼留言