当前位置:网站首页>Experience record of Luogu's topic brushing
Experience record of Luogu's topic brushing
2022-06-27 07:43:00 【#math. h】
1. Transform ideas : Variable angle ; The result is finally processed 100 10% 120
2. rounding :
/* +0.5 Words , If greater than or equal to 0.5 Just move forward , Less than 0.5 Don't move forward , Then cast to int It's going to round down , Just round to an integer , This is one of the simplest rounding methods I think . If you need to round to one place , then * How much and then divide For example, one decimal place is *10/10.0 The last two *100/100.0 With one .0 It means floating point operation , So it won't be over int 了 Law two : cout<<**floor**(s*10+0.5)/10.0;// return s The result rounded to the second decimal place 
4. double s=0.0000;// Please pay attention to the accuracy
sn Use double, Otherwise, the accuracy is not enough ……
Note the data types on both sides of the division ( Can't make it int, Otherwise, it is equal to div operation )
5. Mathematical thought : Geometric series
6. Note that the distance entered may be decimal , So it has to be defined as a floating point number .
7. unsigned long long n,ans=0; // The pit is right here . The days are so big , Will the total distance be small ???
8.c Language has sprintf and sscanf, Corresponding stringstream Read and write of string stream
<stdlib.h> There is also the conversion between numeric values and strings iota and atoi function , Those who are interested can learn about it by themselves . use c Linguistic sprintf Than C++ High efficiency of string stream , But I still want to use C++ String , Why? ? because C++ The extensibility and flexibility of strings are relatively high hhhh
9. Header file
count(ivec.begin() , ivec.end() , searchValue) This function is used to count the number of occurrences of a certain value within a certain range
10.2 The loveliness of a fish may be the same , So we need to discretize
Let's focus on discretization : For the following 4 Number , 10, 12, 9, 15 So the corresponding The largest number is : 2,3,1,4; That is to convert a large number into a small value ( One-to-one correspondence , People who have studied discrete mathematics should know this ), As follows : 10,12,9,15 First, the sequence subscript corresponding to the input :1,2,3,4; Put this 2 Put the rows in the structure ; Then the structure array follows the first line (10,12,9,15) Sort from small to large , The comparison function should be easy to write , The results are as follows : 9,10,12,15; Corresponding to the next behavior 3,1,2,4; And then put 9,10,12,15 Switch to 1,2,3,4, This structure is then constructed in accordance with the 2 OK, just line up again from small to large , obtain : first line 2,3,1,4, The first 2 That's ok 1,2,3,4; This 2,3,1,4 Is the result of discretization , Note that there may be repeated numbers for this question , therefore In the 9,10,12,15 Switch to 1,2,3,4 Pay attention to , If yes 10,10, 12,15 Change it into 1,1,2,3; The input data may be 0, So the input value should be added 1
11. The idea of the bucket : cin>>a[i];// Read in g[a[i]]=1;// Assign a value of... In the set 1
12.//in[j]-‘a’: Read the position of the corresponding letter in , such as ’a’ Corresponding 0,‘b’ Corresponding 1,‘c’ Corresponding 2(0 Start );
//in[j]-‘a’+n: The corresponding position of the letter obtained by adding the transfer digit to the corresponding letter in the reading .
// for instance ’c’ This letter moves 3 position , That is the first. 2 Letters move to the right 3 individual , It's the fifth letter , namely ’f’
// Remainder 26 Is to prevent the number of bits from moving more than 26 Cause to blow up
// Plus ’a’, Restore the corresponding position to letters , Then type it out
11. Recurrence ( The initial conditions should be improved first ) Looking for a regular Think more about recursion
12. annular You can take the mold
13. The second one is —— It also improves the level of knowledge ——C++ Li real type if 0 Divide by a negative number to get -0 = = This operation is really explosive ! At the last point, I made a mistake , A special judgment is required
边栏推荐
- 再见了,敏捷Scrum
- Publications under nature, science and cell
- Remote connection raspberry pie in VNC Viewer Mode
- How can I import data from Oracle into fastdfs?
- JS uses the while cycle to calculate how many years it will take to grow from 1000 yuan to 5000 yuan if the interest rate for many years of investment is 5%
- C how to call line and rows when updating the database
- 什么是期货反向跟单?
- JS, and output from small to large
- Speech signal processing - concept (I): time spectrum (horizontal axis: time; vertical axis: amplitude), spectrum (horizontal axis: frequency; vertical axis: amplitude) -- Fourier transform -- > time
- Jupiter notebook file directory
猜你喜欢

js中判断奇偶的函数,求圆面积的函数

Origin of forward slash and backslash

Goodbye, agile Scrum

JS use switch to output whether the result is qualified

Gérer 1000 serveurs par personne? Cet outil d'automatisation o & M doit être maîtrisé

游戏六边形地图的实现

【批处理DOS-CMD命令-汇总和小结】-将文件夹映射成虚拟磁盘——subst

Programming life - what do you think of the 35 year old bottleneck of programmers?

js输出形状

Stream常用操作以及原理探索
随机推荐
R 中的 RNA-Seq 数据分析 - 调查数据中的差异表达基因!
js打印99乘法表
JS print 99 multiplication table
大厂工作十年,年薪40万突然被裁员,公司想抛弃你,一分情面都不会留
延时队列`DelayQueue`
Windows下mysql-8下载、安装、配置教程
The first part of the construction of the defense system of attack and defense exercise is the introduction and the four stages of Defense
c的时间函数算效率
JS find the number of all daffodils
无论LCD和OLED显示技术有多好,都无法替代这个古老的显示数码管
移动安全工具-jad
JS uses the while cycle to calculate how many years it will take to grow from 1000 yuan to 5000 yuan if the interest rate for many years of investment is 5%
【12. 最大连续不重复子序列】
一個人管理1000臺服務器?這款自動化運維工具一定要掌握
js用switch输出成绩是否合格
(resolved) NPM suddenly reports an error cannot find module 'd:\program files\nodejs\node_ modules\npm\bin\npm-cli. js‘
Bean copy details
语音信号处理-概念(二):幅度谱(短时傅里叶变换谱/STFT spectrum)、梅尔谱(Mel spectrum)【语音的深度学习主要用幅度谱、梅尔谱】【用librosa或torchaudio提取】
JS, and output from small to large
Goodbye, agile Scrum