当前位置:网站首页>[prefix and notes] prefix and introduction and use
[prefix and notes] prefix and introduction and use
2022-07-04 00:34:00 【muse_ age】
The prefix and :( Before similar series n Xiang He )
use sum Before array record i Xiang He
sum[i]=a[0]+a[1]...+a[i]
purpose : You can quickly find the interval 【i,j】 Sum of all numbers

Subtract the two formulas to prove
/* Prefixes and notes :
1. It is known that num Array , Apply for another one of the same size sum Array
2. For the sake of calculation ,num Array and sum Arrays are all subscript 1 For the first element
3. Edge input , Edge update sum Array
sum[0]=0;
for(int i=1;i<=n;i++)
{
cin>>num[i];
sum[i]=sum[i-1]+a[i];
}
4. seek sum[i..j]( That is to say i The number to the first j The number and )
sum[i..j]=sum[j]-sum[i-1]
If i be equal to 1,sum[1..j]=sum[j]-sum[0]=sum[j]
therefore ,num&&sum Array from 1 Start and sum[0]=0
边栏推荐
- The difference between objects and objects
- Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
- 【leetcode】300. Longest increasing subsequence (dynamic programming, dichotomy)
- [error record] configure NDK header file path in Visual Studio
- MySQL winter vacation self-study 2022 12 (2)
- P3371 [template] single source shortest path (weakened version)
- Selenium library 4.5.0 keyword explanation (4)
- How to trade spot gold safely?
- [BSP video tutorial] stm32h7 video tutorial phase 5: MDK topic, system introduction to MDK debugging, AC5, AC6 compilers, RTE development environment and the role of various configuration items (2022-
- [complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!
猜你喜欢

What is the future of software testing industry? Listen to the test veterans' answers

(Introduction to database system | Wang Shan) Chapter V database integrity: Exercises
![[Mongodb] 2. Use mongodb --------- use compass](/img/d5/0eb7dd4c407fbf2e9ba1b175f5424d.jpg)
[Mongodb] 2. Use mongodb --------- use compass

Pytest unit test framework: simple and easy to use parameterization and multiple operation modes

Cannot build artifact 'test Web: War expanded' because it is included into a circular depend solution

What is regression testing? Talk about regression testing in the eyes of Ali Test Engineers

MySQL 8.0.12 error: error 2013 (HY000): lost connection to MySQL server during query

It is worthy of "Alibaba internal software test interview notes" from beginning to end, all of which are essence

It is forbidden to splice SQL in code

Report on the construction and development mode and investment mode of sponge cities in China 2022-2028
随机推荐
Make small tip
What insurance products should be bought for the elderly?
It is forbidden to splice SQL in code
Selenium library 4.5.0 keyword explanation (I)
How to be a professional software testing engineer? Listen to the byte five year old test
Self study software testing. To what extent can you go out and find a job?
Tencent interview: can you find the number of 1 in binary?
A Kuan food rushed to the Shenzhen Stock Exchange: with annual sales of 1.1 billion, Hillhouse and Maotai CCB are shareholders
Struct in linked list
Generic
不得不会的Oracle数据库知识点(二)
Optimization of for loop
国元证券开户是真的安全可靠吗
老姜的特点
The frost peel off the purple dragon scale, and the xiariba people will talk about database SQL optimization and the principle of indexing (primary / secondary / clustered / non clustered)
A method to solve Bert long text matching
Arc 135 supplementary report
Understanding of Radix
Analysis on the scale of China's smart health industry and prediction report on the investment trend of the 14th five year plan 2022-2028 Edition
Software testers, how can you quickly improve your testing skills? Ten minutes to teach you