摘要:
#include#include#includeusing namespace std;void ui(){ cout a,int m, int n){ for(int i = 0; i b, int n){ int sum = 0; fo... 阅读全文
摘要:
递归经典问题 将正整数表示成一系列整数之和 n = n1 + n2 + n3 +++ nk n1>=n2>=n3 >=nk >= 1; 正整数n的这种表示称为正整数n的划分。求正整数n的不同划分个数 例如 5 可以划分为(5), (4,1),(3,2),(3,1,1)... 阅读全文
摘要:
#include#includeusing namespace std;struct T{ friend bool operator b.x; } int x;};int main(){ priority_queue q; T c; ... 阅读全文
摘要:
#includeusing namespace std;int main(){ int t, n, z, i, x, begin, last, temp, _case = 1; cin>>t; while(t--) { begin... 阅读全文
摘要:
#include#includeclass set{public:set(int *q=NULL, int length1=0);friend set operator+(set &e, set &f);friend set operator*(set &e, set... 阅读全文
摘要:
#include using namespace std;int subsequence( int A[], int N);int main(){ int a[100], n;cin>>n;for(int i = 0; i >a[i]; c... 阅读全文
摘要:
#include#includeusing namespace std;struct T{ friend bool operator a2.x; } int x;};int main(){ T a; priority_queue q;... 阅读全文
摘要:
1049最大子段和基准时间限制:1 秒 空间限制:131072 KB 分值: 0难度:基础题 收藏 关注 取消关注N个整数组成的序列a[1],a[2],a[3],…,a[n],求该序列如a[i]+a[i+1]+…+a[j]的连续子段和的最大值。当所给的整数均为负数时和... 阅读全文
摘要:
//构造一个最大堆,然后反着输出去#includeint h[101];int n;void swap(int x, int y){ int t; t = h[x]; h[x] = h[y]; h[y] = t;}void siftdown(i... 阅读全文
摘要:
#include#include int main(){ int data[101], right[101];//right[i] = n代表data[i]右边的元素是data[n] eg right[3] = 10 表示data[3]右边的元素是data[10... 阅读全文