题意:
给出三组小数,每组三个,分别代表一场比赛下注一块钱胜平负的赔率。输出投注的方案并计算投注两块钱期望收获。(赔率相乘后乘上0.65再减去本金2块钱)
AAAAAccepted code:
1 #include<bits/stdc++.h> 2 using namespace std; 3 double a[5][5]; 4 double mx[5]; 5 int pos[5]; 6 int main(){ 7 for(int i=1;i<=3;++i) 8 for(int j=1;j<=3;++j){ 9 cin>>a[i][j]; 10 if(a[i][j]>mx[i]){ 11 mx[i]=a[i][j]; 12 pos[i]=j; 13 } 14 } 15 for(int i=1;i<=3;++i){ 16 if(pos[i]==1) 17 cout<<"W"<<" "; 18 else if(pos[i]==2) 19 cout<<"T"<<" "; 20 else if(pos[i]==3) 21 cout<<"L"<<" "; 22 } 23 double ans=(mx[1]*mx[2]*mx[3])*0.65*2.0-2.0; 24 printf("%.2f",ans); 25 return 0; 26 }