Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.32 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int d, l, a, b, n, s, w, cls, clw, ils, ilw, it, cs, cw, cc;
  4. float k, j;
  5. int st[501];
  6. bool sz, wo;
  7. int main()
  8. {
  9. ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  10. cin>>d>>l>>a>>b>>n;
  11. for(int h=0; h<n; h++)
  12. {
  13.     cin>>st[h];
  14.     if(h==n-1)
  15.     {
  16.         st[n]=d-st[h];
  17.     }
  18.     if(h>0)
  19.     {
  20.         st[h]=st[h]-st[h-1];
  21.     }
  22. }
  23. ils=(100*l)/a;
  24. ilw=(100*l)/b;
  25. //szybki
  26. int z=ils;
  27. for(int h=0; h<=n; h++)
  28. {
  29.     if(st[h]>ils)
  30.     {
  31.         sz=true;
  32.     }
  33.     if(z<=st[h])
  34.     {
  35.         cls++;
  36.         z=ils;
  37.         it=h;
  38.         z=z-st[h];
  39.     }
  40.     else if(z>st[h])
  41.     {
  42.         z=z-st[h];
  43.     }
  44. }
  45. //wsciekly
  46. z=ilw;
  47. for(int h=0; h<=n; h++)
  48. {
  49.     if(st[h]>ilw)
  50.     {
  51.         wo=true;
  52.     }
  53.     if(z<st[h])
  54.     {
  55.         clw++;
  56.         z=ilw;
  57.         it=h;
  58.         z=z-st[h];
  59.     }
  60.     else if(z>=st[h])
  61.     {
  62.         z=z-st[h];
  63.     }
  64. }
  65. k=(60*d/200);
  66. j=(60*d/100);
  67. cs=(cls*20)+k;
  68. cw=(clw*20)+j;
  69. if(sz==false && wo==false)
  70. {
  71.     cc=min(cs, cw);
  72. }
  73. else if(sz==true)
  74. {
  75.     cc=cw;
  76. }
  77. else
  78. {
  79.     cc=cs;
  80. }
  81. if(cc%60!=0)
  82. {
  83.     cout<<cc/60<<" h "<<cc%60<<" m"<<endl;
  84. }
  85. else
  86. {
  87.     cout<<(cc/60)<<" h "<<"0 m"<<endl;
  88. }
  89. if((sz==true || cw<cs) && wo==false)
  90. {
  91.     cout<<"wsciekly";
  92. }
  93. else
  94. {
  95.     cout<<"szybki";
  96. }
  97.  
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement