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 明明觉得是水题,而我却做了一个小时. 明明觉得代码没有错,而我却错了好几次. 因为我的名字不叫明明,也不 ...
随机推荐
- CrackMe破解系列第一番Acid_burn
本文作者:gncao 楼主目前是做渗透测试的,在看一些大神的文章时,有时会看到一些关于逆向方面的知识,无奈楼主不懂逆向.但是身为搞技术的嘛,不懂就学,学不懂就再学,所以就在前些日子看了一些基础的汇编视 ...
- jdk1.6 支持 tls1.2协议 并忽略身份验证
jdk1.6不支持tls1.2协议,jdk1.8默认支持,比较好的解决方案是升级jdk,但是升级jdk风险极大.不能升级jdk的情况下,可以使用如下方式. 引入依赖 <dependency> ...
- 爬虫3:requests库
一个简单易用的http库,多用于第一步,爬取网站源码 简单例子 import requests response = requests.get('https://www.baidu.com ...
- oracle常用cmd命令
登陆 sqlplus username/password; 切换: conn username/password; 显示当前登陆用户: show user; 查看用户列表 select usernam ...
- TSL协议升级导致的问题:caught when processing request: Received fatal alert: protocol_version
近日,公司升级TSL协议,禁用TSL1.0,导致原本好好的https接口,报以下错误: 2019-03-05 15:43:29 [org.apache.commons.httpclient.HttpM ...
- pycharm连接数据库出现时区jdbc问题
unrecognized or represents more than one time zone. You must configure either the server or JDBC dri ...
- TP5 隐藏入口文件 index.php
找到public下的.htaccess <IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine ...
- 浏览器页面的显隐对js的setInterval()执行所产生的bug
前段时间,所写的一个”js无间隙滚动效果“,当页面离开后,重新返回时,会出现动画的错乱.我以为是因为我代码逻辑的原因导致的,但是,当在火狐浏览器上进行浏览时却没有动画错乱的问题. 于是乎,在网上查找是 ...
- [Xamarin.iOS] 如何引用Objective-c寫的Class Library (转帖)
這個範例是如何在Xamarin.ios中去使用一個我們自行在Xcode中開發的Objective-c Class Library. 主要會執行的步驟如下 1. 在Xcode 裡面去建立一個Class ...
- (转)GlusterFS 01 理论基础,企业实战,故障处理
https://jaminzhang.github.io/glusterfs/GlusterFS-01-Theory-Basis/--------GlusterFS 01 理论基础 https://j ...