NOI 191钉子和小球.cpp

时间:2024-09-01 17:08:08
 #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
long long f[][];
int n,m;
char c;
long long gcd(long long ,long long );
int main()
{
scanf("%d%d",&n,&m);
f[][]=(long long)<<n;
for(int i=;i<=n;i++)
for(int j=;j<=i;j++)
{
do
{
scanf("%c",&c);
}
while(c!='*'&&c!='.');
if(c=='*')
{
f[i+][j]+=f[i][j]/;
f[i+][j+]+=f[i][j]/;
}
else if(c=='.')
f[i+][j+]+=f[i][j];
}
long long x=gcd(f[n+][m+],(long long)<<n);
long long k=((long long)<<n)/x;
cout<<f[n+][m+]/x<<"/"<<k<<endl;
return ;
}
long long gcd(long long x,long long y)
{
if(x%y==) return y;
return gcd(y,x%y);
}