fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. double v1, t1, v2, t2, v3, t3;
  6. cin >> v1 >> t1 >> v2 >> t2;
  7. v3 = v1 + v2;
  8. t3 = (v1 * t1 + v2 * t2) / v3;
  9. cout << v3 << " " << t3 << endl;
  10. return 0;
  11. }
Success #stdin #stdout 0s 3460KB
stdin
0 1000000 1 5
stdout
1 5