PersonalCorpus 版 (精华区)

41694 2002-10-15 01:48:47 Accepted
1058 C++ 00:00.00 380K Big Guava


int main()
{
#ifndef ONLINE_JUDGE
    freopen("c:\\0acm\\zju\\i1058","r",stdin);
    freopen("c:\\0acm\\zju\\o1058","w",stdout);
#endif

    int i,j,k,n,p[12],t;
    double dl[6][6],m;

    scanf("%d\n",&t);
    while (t--) {
        for (i=1;i<6;i++) for (j=1;j<6;j++) scanf("%lf",&dl[i][j]);
        while (1) {
            scanf("%d",&n);
            if (n==0) break;
            p[0]=1; p[n+1]=1;
            for (i=1;i<=n;i++) scanf("%d",&p[i]);
            scanf("%lf",&m); m*=100;
            for (i=0;i<=n;i++)
                m=floor(m*dl[p[i]][p[i+1]]+0.5);
            printf("%.2lf\n",m/100);
        }
        if (t>0) printf("\n");
    }
}
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.023毫秒