Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define in() freopen("in.txt", "r", stdin)
- #define out() freopen("out.txt", "w", stdout)
- double hh, mm;
- double h, d, c, n;
- double with_disc()
- {
- double time=((20-hh)*60)+mm;
- double hlvl=h+(time*d);
- double b=(hlvl*1.0)/n;
- double bun=ceil(b);
- double cost=bun*c;
- double disc=cost*0.2;
- double ans=cost-disc;
- return ans;
- }
- double without_disc()
- {
- double hlvl=h;
- double b=(hlvl*1.0)/n;
- double bun=ceil(b);
- double cost=bun*c;
- double ans=cost*1.0;
- return ans;
- }
- int main()
- {
- //in();
- //out();
- double wd,wtd;
- scanf("%lf%lf", &hh,&mm);
- scanf("%lf%lf%lf%lf", &h,&d,&c,&n);
- if(hh>=20){
- double hlvl=h;
- double b=(hlvl*1.0)/n;
- double bun=ceil(b);
- double cost=bun*c;
- double disc=cost*0.2;
- double ans=cost-disc;
- printf("%0.4lf\n", ans);
- }
- else{
- wd=with_disc();
- wtd=without_disc();
- if(wd<wtd)
- printf("%0.4lf\n", wd);
- else
- printf("%0.4lf\n", wtd);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment