CodeForces 604A(浮点数)
这道题需要注意一个点,浮点数的误差问题
判断里的0.3*a[i]换成3*a[i]/10就过了
这个后面还要专门研究一下
#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
using namespace std; #define mem(a,b) memset(a,b,sizeof(a))
#define pf printf
#define sf scanf
#define debug printf("!\n")
#define INF 10000
#define MAX(a,b) a>b?a:b
#define blank pf("\n")
#define LL long long int m[],sub[]; int val[]={,,,,}; int main()
{
int i,j,r,t;
for(i=;i<;i++)
sf("%d",&m[i]);
for(i=;i<;i++)
sf("%d",&sub[i]);
sf("%d%d",&r,&t);
int res = ;
for(i=;i<;i++)
{
res+=MAX(0.3*val[i],(-((double)m[i]/))*val[i]-*sub[i]);
}
res+=(*r-*t); pf("%d\n",res); return ;
}
CodeForces 604A(浮点数)的更多相关文章
- 【 CodeForces 604A】B - 特别水的题2-Uncowed Forces
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102271#problem/B Description Kevin Sun has jus ...
- codeforces 604A Uncowed Forces
题目链接:http://codeforces.com/problemset/problem/604/A 题意:求cf比赛每次能够增加的排名,运算规则会告诉你 题目分类:数学 题目分析:用题目给的公式直 ...
- 【51.27%】【codeforces 604A】Uncowed Forces
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- codeforces 633E Startup Funding(浮点数处理)
codeforces 633E Startup Funding 题意 枚举左端点,对于每个左端点求一个最大的右端点使得最大. 对于得到的这个数组,随机选择k个数,求最小值期望. 题解 对于每个左端点, ...
- Codeforces 1 C. Ancient Berland Circus-几何数学题+浮点数求gcd ( Codeforces Beta Round #1)
C. Ancient Berland Circus time limit per test 2 seconds memory limit per test 64 megabytes input sta ...
- CodeForces 404 Marathon ( 浮点数取模 -- 模拟 )
B. Marathon time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...
- codeforces 404 B Marathon【fmod对浮点数取余】
题意:给出一个边长为a的正方形,给出d,给出n,输出走得距离为i个d的时候的坐标 学习的这一篇 http://blog.csdn.net/synapse7/article/details/215956 ...
- codeforces Looksery Cup 2015 H Degenerate Matrix 二分 注意浮点数陷阱
#include <cstdio> #include <cstring> #include <algorithm> #include <string> ...
- CodeForces 618A Slime Combining
http://www.codeforces.com/contest/618/problem/A 明明觉得是水题,而我却做了一个小时. 明明觉得代码没有错,而我却错了好几次. 因为我的名字不叫明明,也不 ...
随机推荐
- 在 django模型中封装元组和字典, 字段中使用chioce参数实现数据的一一对应
一.models.py中 class OrderInfo(BaseModel): '''订单模型类''' # 封装一个字典, 便于在视图中取值, 进行比对 PAY_METHODS = { : &quo ...
- [ActionScript3.0] 使用FileReferenceList处理多个文件上载
package { import flash.display.Sprite; import flash.events.DataEvent; import flash.events.Event; imp ...
- dbus-launch(转)
*NAME* dbus-launch - Utility to start a message bus from a shell script dbus-launch - 从shell脚本启动一个消息 ...
- JMeter PerfMon Metrics Collector性能监控插件
官方文档地址https://jmeter-plugins.org/wiki/PerfMon/ JMeter是一款压力测试工具,我们也可以用它来监控服务器资源使用情况. JMeter正常自带可以通过To ...
- Python之scrapy框架之post传输数据错误:TypeError: to_bytes must receive a unicode, str or bytes object, got int
错误名:TypeError: to_bytes must receive a unicode, str or bytes object, got int 错误翻译:类型错误:to_bytes必须接收u ...
- C++基础知识-派生类、调用顺序、访问等级、函数遮蔽
一.派生类的概念 类之间有一种层次关系,有父亲类,有孩子类. 车这个类,当成父类(也叫基类.超类),派生出卡车.轿车,他们属于孩子类(子类.派生类) 继承:有父亲类,有孩子类,构成了层次关系.继承这种 ...
- 转一下大师兄的"MySQL高可用架构之MHA"
简介: MHA(Master High Availability)目前在MySQL高可用方面是一个相对成熟的解决方案,它由日本DeNA公司youshimaton(现就职于Facebook公司)开发,是 ...
- 【Quartz】Spring Boot使用properties文件配置Quartz
(1)在resource目录下新建quartz.properties文件 #============================================================== ...
- Eclipse安装genymotion最新的方法
https://www.cnblogs.com/WXBai/p/5938884.html 安卓开发: http://tools.android-studio.org/index.php/sdkhttp ...
- spark持久化
spark持久化:cache .persist.checkpoint 一.cache持久化 cache实际上是persist的一种简化方式,是一种懒执行的,执行action类算子才会触发,cahce后 ...