cf 421 (2 of 5)
来源:互联网 发布:中国原油进口数据 编辑:程序博客网 时间:2024/06/16 05:45
希望自己之后能稳3题啊啊啊啊。 421题目
A/B都比较水。
A:
#include <cstdio>#include <cstring>#include <iostream>using namespace std;int main(){ int c,v0,v1,a,l; scanf("%d%d%d%d%d",&c,&v0,&v1,&a,&l); int ans = -1,sum = 0; for(int i = 0; ; i++) { int temp = v0 + a*i; if(temp >= v1) temp = v1; sum += temp; if(sum >= c) {ans = i;break;} sum -= l; } printf("%d\n",ans+1); return 0;}
B:
#include <cstdio>#include <cstring>#include <iostream>#include <cmath>using namespace std;const int inf = 0x3f3f3f3f;int main(){ int n,a; scanf("%d%d",&n,&a); double sum = 180*(n-2); double e = sum/n; double ll = e/(n-2); int ans = -1; double mind = inf; for(int i = 1; i <= n-2; i++) { if(abs(a-i*ll) < mind) {ans = i; mind = abs(a-i*ll);} } cout << 2 << " " << 1 << " " << 2 + ans << endl; return 0;}
阅读全文
0 0
- cf 421 (2 of 5)
- [CF]Sums of Digits
- CF King of Thieves
- CF Flag of Berland
- CF-edu#5 E - Sum of Remainders -数学-枚举
- CF-Codeforces Round #392 (Div. 2)-A-Holiday Of Equality
- CF Round #411 (Div. 2) Minimum number of steps
- OF位 与 CF位
- <cf>System of Equations(水题)
- cf D. Bag of mice
- CF 600D(Area of Two Circles' Intersection-2圆面积并)
- cf#VK Cup 2015 - Qualification Round 2-D - Statistics of Recompressing Videos-优先队列模拟
- CF Round #418( Div.2) An impassioned circulation of affection
- CF-Codeforces Round #418 (Div. 2)-C-An impassioned circulation of affection
- CF —— Codeforces Round #428 (Div. 2) B. Game of the Rows
- CF与OF有什么区别?
- MUL指令对OF、CF的影响
- 溢出OF和进位CF区别
- Html常用标签元素
- 微信emoji表情编码的处理与储存
- nexus搭建maven私服及私服jar包上传和下载
- android 6.0 SystemUI源码分析(1)-SystemUI介绍
- A child container failed during start java.util.concurrent.ExecutionException异常解决
- cf 421 (2 of 5)
- 各大公司后端java面试题总结
- 多线程——————停止线程
- 在shiro当设置sessionIdCookie配置的domain和访问url不匹配时,每次请求都会重新生成session
- HTML 标签解释大全
- 学习Linux命令(51)
- 3.Longest Substring Without Repeating Characters-python
- Android强大的数据库开源框架LitePal
- Ceph新长支持稳定版本Luminous(12.x.x)新功能总结