⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1058.cpp

📁 浙大acm在线评判系统zju online judge上面的题目解答源码(1)
💻 CPP
字号:
#include <iostream>
//#include <fstream>
#include <iomanip>
#include <math.h>
using namespace std;

int main()
{
//     ifstream infile;
 //ofstream outfile;
cout.setf(ios::fixed);//<<fixed<<showpoint;
	  
	  cout<<setprecision(2);
	

		int N,i,j;
   int n=1,*a;
   float t[5][5],b,total=0;
   //infile.open("in.txt");
	//outfile.open("out.txt");
   
   cin>>N;
   while(N--)
   {
    for(i=0;i<5;i++)
	   for(j=0;j<5;j++)
		   cin>>t[i][j];
  
        cin>>n;
	   while(n)
	   { 
             a=new int[n+2];
             a[0]=0;
	         a[n+1]=0;
	           for(i=1;i<=n;i++)
			   {   cin>>a[i];
	                a[i]=a[i]-1;
			   }
     	     cin>>b;
             total=b;
             for(i=0;i<=n;i++)
  	         {total=total*t[a[i]][a[i+1]];
  	          total = floor(total * 100 + 0.5) / 100; //floor(float n)不大于n的最大整数 
  	         }
	      if(total<1) total=0;   
          cout<<total<<endl;
	 
	   
             delete[] a;
             cin>>n;
  	    }
    if(N>=1) cout<<endl;
   
  }
	//  infile.close();
	 //  outfile.close();
   
   return 0;
   
   
  

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -