基础 树状数组
每输入一组数,就对染色次数进行修改;
#include
#include
#include
using namespace std;
int s[100005],a;
int low(int i)
{
return i&(-i);
}
void show(int q,int w)
{
while(q>0)
{
s[q]+=w;...
分类:
其他好文 时间:
2014-07-22 22:49:35
阅读次数:
188
【来信】 老师,关于算法和数据结构我还是有点疑惑。你说要通过实践,我现在看到数据结构的图了,算法学习我借了刘汝佳的算法入门那本书,数据结构我把书中的代码在电脑上敲了出来,并且搞懂了第一行代码,也算是记住了思想。但是有时候敲完后会觉得模糊。算法在看动态规划,对于动态规划里面提到的“状态”我还是不能很好的理解。我想问问老师,如果长时间过后数据结构和算法的思想忘了怎么办,怎么学习数据结构和算法才算是正...
分类:
其他好文 时间:
2014-07-22 22:49:33
阅读次数:
214
Jzzhu has invented a kind of sequences, they meet the following property:
You are given x and y,
please calculate fn modulo 1000000007 (109?+?7).
Input
The first line contains two int...
分类:
其他好文 时间:
2014-07-22 22:49:33
阅读次数:
296
Jzzhu has a big rectangular chocolate bar that consists of n?×?m unit squares. He wants to cut this bar exactly k times.
Each cut must meet the following requirements:
each cut should be straig...
分类:
其他好文 时间:
2014-07-22 22:49:15
阅读次数:
192
There are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the children from 1 to n.
The i-th child wants to get at least ai candies.
Jzzhu asks childre...
分类:
其他好文 时间:
2014-07-22 22:49:13
阅读次数:
237
//输入年月日,判断是该年的第几天,还可以进一步判断从1年开始的第几天
#include
using namespace std;
int main()
{
int Day(int x,int y,int r);
int Calculate_1(int x,int y,int r);
int Calculate_2(int n);
int n,y,r;/**************...
分类:
其他好文 时间:
2014-07-22 22:48:55
阅读次数:
258
题目大意:
求一个窗口覆盖最多的星星的权值。
思路分析:
每一个星星看成
左下点为x y
右上点为x+w-1 y+h-1 的矩形。
然后求出最大覆盖的和。
#include
#include
#include
#include
#define lson num<<1,s,mid
#define rson num<<1|1,mid+1,e
#define max...
//已经排好的数组,输入一个数,按原来的规律插入数组中;
#include
using namespace std;
int main()
{
int a[100];
int i,k,t;
for(i=0;i
a[i]=(i+1)*2;
for(i=0;i
{
cout
if((i+1)%10==0)
cout
}
cout
cin>>k;
for(i=0...
分类:
其他好文 时间:
2014-07-20 10:31:35
阅读次数:
130
题意:求最长递增子序列
AC代码:#include
#include
#include
using namespace std;
int dp[1010],a[1010];
int main()
{
int i,j,n;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;...
分类:
其他好文 时间:
2014-07-20 10:28:31
阅读次数:
235
下面的创建中断向量表的代码,可以将段vecs(存储中段向量表的段)重定位到某个地址,如DSP的L2起始地址(对于core1,是0x10800000),同时要将ISTP指向这个地址。
;create interrupt vector table for C6000 DSP
;-------------------------------------------------------------...
分类:
其他好文 时间:
2014-07-20 10:27:36
阅读次数:
202