当前位置:网站首页>Floating point comparison, CMP, tabulation ideas
Floating point comparison, CMP, tabulation ideas
2022-07-06 13:21:00 【Rivers overflow】
Floating point comparison
Core part code
cosnt double eps=1e-8;
const double pi=acos(-1.0);
#define Equ(a,b) ((fabs((a)-(b)))<(eps))
#define More(a,b) (((a)-(b))>(eps))
#define Less(a,b) (((a)-(b))<(-eps))
#define MoreEqu(a,b) (((a)-(b))>(-eps))
#define LessEqu(a,b) (((a)-(b))<(eps))
Be careful !abs And fabs
sort Functional cmp
bool cmp(node a,node b)
{
return a.score<b.score;// Represents the order from small to large
}
The meter
① Calculate all the results needed in the program at one time , For example, the first few values of fiboracci sequence are directly filled into the array and directly queried
② In procedure b Calculate all the results needed in one or more times , Manually write the results in the program A In the array , And so on
③ Violence is a small-scale result , Looking for a regular
边栏推荐
- The earth revolves around the sun
- 十分鐘徹底掌握緩存擊穿、緩存穿透、緩存雪崩
- Counter attack of flour dregs: redis series 52 questions, 30000 words + 80 pictures in detail.
- 抽象类和接口
- FileInputStream和BufferedInputStream的比较
- 西安电子科技大学22学年上学期《射频电路基础》试题及答案
- 初识C语言(下)
- Alibaba cloud microservices (III) sentinel open source flow control fuse degradation component
- TYUT太原理工大学2022软工导论大题汇总
- TYUT太原理工大学往年数据库简述题
猜你喜欢
How to ensure data consistency between MySQL and redis?
Introduction and use of redis
一文搞定 UDP 和 TCP 高频面试题!
Interview Essentials: talk about the various implementations of distributed locks!
Dark chain lock (lca+ difference on tree)
Questions and answers of "Fundamentals of RF circuits" in the first semester of the 22nd academic year of Xi'an University of Electronic Science and technology
View UI plus released version 1.3.0, adding space and $imagepreview components
TYUT太原理工大学2022数据库大题之数据库操作
Arduino+ water level sensor +led display + buzzer alarm
IPv6 experiment
随机推荐
TYUT太原理工大学2022数据库大题之概念模型设计
Questions and answers of "basic experiment" in the first semester of the 22nd academic year of Xi'an University of Electronic Science and technology
Alibaba cloud side: underlying details in concurrent scenarios - pseudo sharing
All in one 1405: sum and product of prime numbers
Tyut Taiyuan University of technology 2022 introduction to software engineering
First acquaintance with C language (Part 1)
ROS machine voice
3.C语言用代数余子式计算行列式
IPv6 experiment
Comparison between FileInputStream and bufferedinputstream
Introduction pointer notes
(超详细onenet TCP协议接入)arduino+esp8266-01s接入物联网平台,上传实时采集数据/TCP透传(以及lua脚本如何获取和编写)
Inheritance and polymorphism (Part 2)
初识指针笔记
1.C语言矩阵加减法
Conceptual model design of the 2022 database of tyut Taiyuan University of Technology
View UI plus released version 1.2.0 and added image, skeleton and typography components
View UI Plus 发布 1.1.0 版本,支持 SSR、支持 Nuxt、增加 TS 声明文件
Small exercise of library management system
TYUT太原理工大学2022数据库考试题型大纲