fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int member1, sum2 = 0;
  8. double member2, res = 0, sum1 = 0;
  9. while (cin >> member1 >> member2)
  10. {
  11. if (member1=='e') break;
  12. sum1 += member1 * member2;
  13. sum2 += member1;
  14. }
  15. res = sum1 / sum2;
  16. cout<< res << endl;
  17. return 0;
  18. }
Success #stdin #stdout 0s 3460KB
stdin
	3 -0.5 2 -0.4 1 -0.3 5 32 11 5 20 -1	
stdout
4.58095