fork download
  1. /* Author haleyk10198 */
  2. /* 作者: haleyk10198 */
  3. #include <iostream>
  4. #include <fstream>
  5. #include <sstream>
  6. #include <cstdlib>
  7. #include <cstdio>
  8. #include <vector>
  9. #include <map>
  10. #include <queue>
  11. #include <cmath>
  12. #include <algorithm>
  13. #include <cstring>
  14. #include <iomanip>
  15. #include <ctime>
  16. #include <string>
  17. #include <set>
  18. #include <stack>
  19.  
  20. #define MOD 1000000007
  21. #define INF 2147483647
  22. #define PI 3.1415926535897932384626433
  23. #define ll long long
  24. #define pii pair<int,int>
  25. #define mp(x,y) make_pair((x),(y))
  26.  
  27. using namespace std;
  28. pii a[10010];
  29.  
  30. struct Custom{
  31. bool operator()(pii a,pii b){
  32. return a.second<b.second||(a.second==b.second&&a.first<b.first);
  33. }
  34. };
  35.  
  36. int main(){
  37. //freopen("input.txt","r",stdin);
  38. //freopen("output.txt","w",stdout);
  39. ios_base::sync_with_stdio(false);
  40. int n;
  41. double w,v,u;
  42. bool f=true;
  43. cin>>n>>w>>v>>u;
  44. for(int i=0;i<n;i++){
  45. cin>>a[i].first>>a[i].second;
  46. if(1.0*a[i].first/v<1.0*a[i].second/u)
  47. f=false;
  48. }
  49. if(f)
  50. cout<<fixed<<setprecision(12)<<1.0*w/u;
  51. else{
  52. sort(a,a+n,Custom());
  53. double x,y,t;
  54. x=y=t=0;
  55. for(int i=0;i<n;i++){
  56. if(a[i].first<x)
  57. continue;
  58. x=a[i].first;
  59. t=max(1.0*x/v,t+1.0*(a[i].second-y)/u);
  60. y=a[i].second;
  61. }
  62. t+=1.0*(w-y)/u;
  63. cout<<fixed<<setprecision(12)<<t<<endl;
  64. }
  65. return 0;
  66. }
  67.  
Success #stdin #stdout 0s 3532KB
stdin
5 5 1 2
1 2
3 1
4 3
3 4
1 4
stdout
5.000000000000