#include<iostream> #include<vector> using namespace std; int main() { int n; cout <<"How many bids?

"<<endl; cin >> n; double p; cout <<"What percentage in prizes? (85% = 85)"<<endl; cin >> p; p/=100; int v; cout <<"Money to get the percentages?"<<endl; cin >> v; vector<double> val(n); for (int i=0; i<n; ++i) { cout <<"Enter - Player "<<i+1<<":"<<endl; cin >> val[i]; } vector<double> pos(n); for (int i=0; i<n; ++i) { double ac=0; for (int j=0; j<n; ++j) { ac+=(val[i]/val[j]); } pos[i]=100/ac; cout <<"Bid "<<i+1<<" "<<pos[i]<<"%"<<endl; } cout <<"Now put money and write what value did u get on player 1"<<endl; double b; cin >> b; b/=v; vector<double> tot(n); double total=(double(v)*val[0]*(b-p))/(p*(val[0]-b)); for (int i=0; i<n; ++i) { tot[i]=total*(pos[i]/100); cout <<"Player "<<i+1<<" "<<int(tot[i])<<" gold bidded."<<endl; } cout <<int(total)<<" gold bidded."<<endl<<int(total*p)<<" gold on prizes."<<endl; vector<bool> qui(n,true); int k; cout <<"What player will not win?"<<endl; cin >> k; double inex=total; while (k>0 and k<=n) { if (qui[k-1]) { inex-=tot[k-1]; cout <<"You win "<<int(total*p-inex)<<" so this is a benefit of "<<(total*p/inex)*100-100<<endl; qui[k-1]=false; } else { cout <<"This player have already beed withdrawed"<<endl; } cout <<"What player will not win? (put a false player to exit)"<<endl; cin >> k;

} int g; double x=(total*p-inex)/(1-p); cout <<x<<" this is the gold max for bid and win."<<endl; double bids=0; for (int i=0; i<n; ++i) { if (qui[i]) bids+=pos[i]; } cout <<"How many gold do you wanna bid?(0 to bid the max)"<<endl; cin >> g; if (g==0) { for (int i=0; i<n; ++i) { if (qui[i]) { cout <<"Player "<<i<<": "<<x*pos[i]/bids<<" gold."<<" u win "<<(x*pos[i]/bids)*pos[i]<<" gold."<<endl; } } } else { } int per; cin >> per; }