Advertisement
rengetsu

CR_471_A

Mar 24th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4. int main()
  5. {
  6. int hh, mm;
  7. double h, h1, d, d1, c, n, a=0, b=0;
  8. cin>>hh>>mm;
  9. cin>>h>>d>>c>>n;
  10. if(h>0)
  11. {
  12.    
  13.         if(hh>=20 && hh<24)
  14.         {
  15.             c=(c/100)*80;
  16.             while(h>0)
  17.             {
  18.             a+=c;
  19.             h-=n;
  20.             }
  21.         }
  22.    
  23. if(hh<20)
  24.     {
  25.     d1=d;
  26.     h1=h;
  27.     while(h1>0)
  28.     {
  29.     b+=c;
  30.     h1-=n;
  31.     }
  32.         while(hh<20)
  33.         {
  34.             for(int i=0;i<61;i++)
  35.             {
  36.                 if(mm==60)
  37.                 {
  38.                 hh+=1;
  39.                 mm=0;
  40.                 break;
  41.                 }else{
  42.                     mm+=1;
  43.                     h+=d;
  44.                 }
  45.             }
  46.         }
  47.             c=(c/100)*80;
  48.             while(h>0)
  49.             {
  50.             a+=c;
  51.             h-=n;
  52.             }
  53.     }
  54. }
  55. else{cout<<fixed<<setprecision(3)<<a<<endl;return 0;}
  56.     if(b==0 && a!=0){cout<<fixed<<setprecision(3)<<a<<endl;return 0;}
  57.     else if(b!=0 && a!=0){
  58.         if(b>a){cout<<fixed<<setprecision(3)<<a<<endl;return 0;}
  59.         else{cout<<fixed<<setprecision(3)<<b<<endl;return 0;}
  60.     }
  61. return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement