#include #include #include #include using namespace std; int checkPic(string tmp, vector coinNameArray); int main() { double expectValue = 0; double tmpExpect; int coin; string coinName; vector coinNameArray(5); vector coinNumber(5); int n[3]; string tmpPic; vector> leel; vector> picNumber(3, vector(5)); leel.resize(3); int matchPattern[5]; for(int i=0; i<5; i++) { cin>>coinName>>coin; coinNameArray[i] = coinName; coinNumber[i]=coin; } for (int i = 0; i < 3; i++) { cin >> n[i]; leel[i].resize(n[i]); for (int j = 0; j < n[i]; j++) { cin >> tmpPic; picNumber[i][checkPic(tmpPic, coinNameArray)]+=1; leel[i][j]=tmpPic; } } for(int i=0; i<5; i++) { tmpExpect= (((double)picNumber[0][i]/n[0])*((double)picNumber[1][i]/n[1])*((double)picNumber[2][i]/n[2])*(double)coinNumber[i]); expectValue += tmpExpect; matchPattern[i] = picNumber[0][i]*picNumber[1][i]*picNumber[2][i]*5; } expectValue *= 5.0; cout< coinNameArray) { for(int i=0; i<5; i++) { if(tmp == coinNameArray[i]) return i; } return 0; }