标签:+= scanf 维数 限制 题意 ret std printf 一维数组
#include<bits/stdc++.h>
using namespace std;
const int maxn = 15;
int g[maxn][maxn];
int nex[maxn][maxn];
int a[maxn*maxn];
double f[maxn*maxn];
int main()
{
for(int i = 1; i <= 10; i++)
for(int j = 1; j <= 10; j++)
nex[i][j] = (i-1)*10 + (i&1 ? j : 11-j);
for(int i = 1; i <= 10; i++)
for(int j = 1, x; j <= 10; j++){
scanf("%d", &x);
a[nex[i][j]] = nex[i-x][j];
}
f[1] = 0;
double sum = 0;
for(int i = 2; i <= 6; i++)
f[i] = (sum+6) / (i-1), sum += f[i];
for(int i = 7; i <= 100; i++)
{
sum = 0;
for(int r = 1; r <= 6; r++)
sum = sum + min(f[i-r], f[a[i-r]]);
f[i] = sum / 6.0 + 1;
}
printf("%.10f", f[100]);
return 0;
}
标签:+= scanf 维数 限制 题意 ret std printf 一维数组
原文地址:https://www.cnblogs.com/zxytxdy/p/11823902.html