骰子游戏

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAXN = 155;
LL GCD(LL a, LL b){
    if(b == 0) return a;
    return GCD(b, a%b);
}
LL Pow(LL a, LL b){
    LL ans = 1;
    while(b){
        if(b & 1) ans = ans*a;
        b>>=1;
        a=a*a;
    }
    return ans;
}
LL c1[MAXN], c2[MAXN];
int main(){
    LL n, x;
    while(~scanf("%lld%lld",&n,&x)){
        for(int i=1; i<=x; i++){
            c1[i]=1;
            c2[i]=0;
        }
        int m = 6;
        for(int i=2; i<=n; i++){
            for(int j=1; j<=m; j++)
                for(int k=1; k<=6&&j+k<=x; k++)
                    c2[j+k]+=c1[j];
            for(int i=1; i<=x; i++){
                c1[i]=c2[i];
                c2[i]=0;
            }
            m+=6;
        }
        LL ans = Pow(6, n);
        LL sum = 0;
        ///for(int i=1; i<=x; i++) printf("%d --> %lld\n",i,c1[i]);
        for(int i=n; i<x; i++) sum += c1[i];
        sum = ans - sum;
        LL g = GCD(sum, ans);
        printf("%lld/%lld\n",sum/g,ans/g);
    }
    return 0;
}