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>…
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102271#problem/B Description Kevin Sun has just finished competing in Codeforces Round #334! The round was 120 minutes long and featured five problems with maximum point values of 500, 1000, 1500,…
题目链接:http://codeforces.com/problemset/problem/604/A 题意:求cf比赛每次能够增加的排名,运算规则会告诉你 题目分类:数学 题目分析:用题目给的公式直接进行运算就好 代码: #include<bits/stdc++.h> using namespace std; ]={,,,,,}; ]; ]; int main() { int s,us; ;i<=;i++) { cin>>m[i]; } ;i<=;i++) { cin…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Kevin Sun has just finished competing in Codeforces Round #334! The round was 120 minutes long and featured five problems with maximum point valu…
codeforces 633E Startup Funding 题意 枚举左端点,对于每个左端点求一个最大的右端点使得最大. 对于得到的这个数组,随机选择k个数,求最小值期望. 题解 对于每个左端点,右端点右移时,是在一个递增.一个递减的函数中取min,二分即可解决. 接下来的问题也很好解决,可以先取log避免精度上溢 代码 #include<bits/stdc++.h> using namespace std; #define fi first #define se second #defi…
C. Ancient Berland Circus time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output Nowadays all circuses in Berland have a round arena with diameter 13 meters, but in the past things were different.…
B. Marathon time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera takes part in the Berland Marathon. The marathon race starts at the stadium that can be represented on the plane as a squa…
题意:给出一个边长为a的正方形,给出d,给出n,输出走得距离为i个d的时候的坐标 学习的这一篇 http://blog.csdn.net/synapse7/article/details/21595639 用fmod可以对浮点数取余 然后当d很大的时候,做除法容易产生较大的误差,所以先用fmod(d,4*a)处理一下(事实证明不处理,会wa在11个数据) #include<iostream> #include<cstdio> #include<cstring> #inc…
#include <cstdio> #include <cstring> #include <algorithm> #include <string> #include <cmath> #include <iostream> using namespace std; bool fun(double l1,double r1,double l2,double r2){ return (l1 <= r2 && l1…
http://www.codeforces.com/contest/618/problem/A 明明觉得是水题,而我却做了一个小时. 明明觉得代码没有错,而我却错了好几次. 因为我的名字不叫明明,也不叫铭铭T_T最后还是铭神指出了我的错误 又新学到了新的姿势: 1.浮点数的比较要用eps来比较 2.log2(n)要写成log10(n)/log10(2) 其他的话这道题目刚开始没有思路,其实在草稿纸上写一下就可以发现了哦我的表达能力太差了只可意会不可言传T_T #include <cstdio>…