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