cf1512F. Education

题意:

小明想买一个价值为c的东西,他开始打工,他一开始在第i个职务,每天可以挣a[i],他也可以用一天的时间并且花费b[i]升到i+1职务,第i+1职务每天可以挣a[i+1]
一共有n个职务,问他最少要多少天才能攒够钱c
2<=n<=2e5

题解:

看看数据范围。。这题直接暴力就行emm
我们直接计算在第i个岗位挣到c需要多少钱,取最小值
因为岗位需要一步一步升,所以到第i个岗位时,要计算好升到第i个岗位所需要的时间,以及当前的钱
详细看看代码,注意细节就行
(比赛时都没看到这题)

代码:

#include<bits/stdc++.h>
#define debug(x,y) printf("%s = %d\n",x,y);
typedef long long ll;
using namespace std;
inline int read(){int s=0,w=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();//s=(s<<3)+(s<<1)+(ch^48);return s*w;
}
const int maxn=2e5+9;
ll a[maxn];
ll b[maxn];
int main()
{int t;cin>>t;while(t--){ll n,c;cin>>n>>c;ll minn=1e13+9;for(int i=1;i<=n;i++)a[i]=0;for(int i=1;i<n;i++)b[i]=0;for(int i=1;i<=n;i++)scanf("%lld",&a[i]);for(int i=1;i<n;i++)scanf("%lld",&b[i]);ll tot=0;ll preday=0;ll pretot=0;for(int i=1;i<=n;i++){tot=preday+ceil(1.0*(c-pretot)/(1.0*a[i]));//到此为止 ll w=ceil(1.0*(b[i]-pretot)/(1.0*(a[i])));//晋升所需要的天数 preday+=w+1;pretot+=(w*a[i])-b[i];minn=min(tot,minn);}printf("%d\n",minn); }
}

cf1512F. Education相关推荐

  1. [CF1512F] Education题解

    点击前往 我的博客访问获得更好的阅读体验 注意   该博客是为了帮助同学学习,并非为了协助同学刷题,请读者保持自觉,请勿做CV工具人.另外为了节省篇幅,代码中不再写明#include,如果遇到我没有声 ...

  2. education and lectures

    education is somehow like a war battle the lecture hall is the front line an auditing student is lik ...

  3. 计算机科学与教育信息化国际会议,A Courses Ontology System for Computer Science Education...

    摘要: A computer knowledge system plays a crucial role in computer education owing to the diversificat ...

  4. 红黄蓝收购新加坡某民营儿童教育集团,宣布更名为GEH Education...

    2月11日消息,日前,红黄蓝教育(NYSE:RYB)发布公告,宣布以1.25亿元收购新加坡一家民营儿童教育集团近70%的股权,并即将从"RYB Education"更名为" ...

  5. GitHub宣布GitHub Education 新计划,学校可免费用企业版

    今天 GitHub 宣布面向所有学校和教育机构开放 GitHub Education,方便学生和老师免费使用 GitHub 企业版功能,以及学生开发者工具包.GitHub 教室.培训等资源. 2014 ...

  6. 线性代数问卷调查反馈——Find The Determinant III,Takahashi‘s Basics in Education and Learning

    文章目录 Find The Determinant III source code Takahashi's Basics in Education and Learning source code F ...

  7. Codeforces 915 E Physical Education Lessons

    题目描述 This year Alex has finished school, and now he is a first-year student of Berland State Univers ...

  8. 【英语学习】【Daily English】U10 Education L02 I'm not a pushy parent

    文章目录 Word Preparation to be honest:老实说 at someone's own pace:依照自己的进度 of someone's own accord:自愿的 I w ...

  9. VOA ECONOMICS REPORT - Junior Achievement Marks 90 Years of Business Education

    Junior Achievement(青年成就)从事商业教育90载  MP3节目录音下载 (1.81 M)     PDF 节目文稿下载 (112 K) http://www.unsv.com/voa ...

最新文章

  1. 终于有人把JAVA虚拟机讲清楚了!
  2. Android ViewPager实现多个图片水平滚动
  3. C#中使用指针转换数据类型[C#/unsafe]
  4. python切割图像,使用Python图像库将一个图像切割成多个图像
  5. 微信开发者工具:Failed to load font ************** net::ERR_CONNECTION_RESET问题解决办法
  6. 魅族15无法连接计算机,还在为数据丢失而烦恼?魅族15告诉你什么叫做碎屏无忧...
  7. leetcode - 646. 最长数对链
  8. dubbo项目引用另一个项目的接口
  9. docker开启otter服务mysql单双向同步数据
  10. 【OSPF引入直连路由时巧借静态黑洞路由做汇总】
  11. wim工具扫描linux磁盘,WimTool Pro(WIM映像处理工具)
  12. 学习Java一般多久?
  13. web如何加入视频?video
  14. 神经网络量化----吐血总结
  15. c语言中的less函数,less的小白入门介绍
  16. 张赐荣 | PHP 获取喜马拉雅音频直链地址
  17. skb_buff 详解(二)
  18. boundschecher
  19. 搭建WDS(Windows部署服务)
  20. HDFS Trash原理分析

热门文章

  1. 电梯里为什么放镜子?90%的人都不知道
  2. 程序员从入门到升级,或许可以看一看这几个公众号
  3. 每日一笑 | 对不起,我还没下班...
  4. office 高效办公智慧树_干货高效实用的office办公小技巧之word篇
  5. qt显示echart_Qt配置,载入html,Echart, 交互
  6. mysql sleep详解_sql注入详解(二)
  7. 计算机硬件相关名词,计算机硬件基础名词解释
  8. freertos源码详解与应用开发 pdf_互联网企业面试必问Spring源码?搞定Spring源码,看完这篇就够了...
  9. 5120v2怎么配置web登陆_阿里企业邮箱如何配置和添加到第三个电子邮件客户端中?...
  10. matlab的灰色关联,灰色关联度Matlab代码