摘要:
# 6-1 最大子段和 因为是字段和,所以要尽可能的多加,如果在加的过程中当前和为负数时,往后累加一定不会比保留当前值更优秀,所以要把之前的部分抛弃重新累加 ```cpp int mis(int a[], const int n) { int res = 0 , sum = 0 ; for( int 阅读全文
摘要:
I 鸽子的整数运算 #include<bits/stdc++.h> using namespace std; int read() { int x = 0, f = 1, ch = getchar(); while ((ch < '0' || ch > '9') && ch != '-') ch = 阅读全文
摘要:
A - When? 问21:00后的第k分钟的时间 #include<bits/stdc++.h> using namespace std; const int N = 2e5+5; int n , a[N] , cnt , k; int32_t main(){ int n , h = 21 , m 阅读全文
摘要:
G 最长递增长度 求一下最长上升子序列,这里用了一个典型的$O(n\log n )$的做法就是模拟栈,并且不断替换栈,使得栈中的元素在保持长度不变的情况下尽可能的小 #include<bits/stdc++.h> using namespace std; int read() { int x = 0 阅读全文