上一页 1 2 3 4 5 6 ··· 13 下一页
摘要: 1 //poj1195 二维线段树之树套树 2 // 先确定横坐标所在的区间并记录该结点的编号p,然后再确定纵坐标所在的区间并记录该结点的编号cur,则tree[cur][p]为目标区间。 3 #include <cstdio> 4 #include <cstdlib> 5 #include <cs 阅读全文
posted @ 2020-04-26 13:08 Daybreaking 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 1 //zoj 2859 2 // 二维线段树之矩形树 求解矩阵和问题 3 #include <cstdio> 4 #include <cstdlib> 5 #include <cstring> 6 #include <cmath> 7 #include <algorithm> 8 #include 阅读全文
posted @ 2020-04-26 13:06 Daybreaking 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 1 #include <cstdio> 2 #include <cstdlib> 3 #include <cstring> 4 #include <iostream> 5 //#define INPUT 6 /** 7 Problem:1182 - 食物链,NOI2001 8 Begin Time: 阅读全文
posted @ 2020-04-26 13:05 Daybreaking 阅读(355) 评论(0) 推荐(0) 编辑
摘要: 1 // D题 判平行四边形的个数 忘记了数学方法 2 #include<cstdio> 3 #include<cstdlib> 4 #include<cstring> 5 #include<cmath> 6 #include<algorithm> 7 #include<queue> 8 #incl 阅读全文
posted @ 2020-04-26 13:03 Daybreaking 阅读(248) 评论(0) 推荐(0) 编辑
摘要: 1 //A vector不T 2 // 最短路 SPFA 3 // in数组 4 5 #include<cstdio> 6 #include<cstdlib> 7 #include<cstring> 8 #include<cmath> 9 #include<algorithm> 10 #includ 阅读全文
posted @ 2020-04-26 13:00 Daybreaking 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 问题:求(a+b)^n中各项的系数。 方法一:利用杨辉三角 11 11 2 11 3 3 11 4 6 4 11 5 10 10 5 11 6 15 20 15 6 1 (a+b)^1=a+b (a+b)^2=a^2+2ab+b^2 (a+b)^3=a^3+3b*a^2+3a*b^2+b^3 ... 阅读全文
posted @ 2020-04-26 12:41 Daybreaking 阅读(547) 评论(0) 推荐(0) 编辑
摘要: 第一种:利用赋值号直接赋值 char a = 40; string b = a; /* 错误。因为string是一个指针,存储的值是所指向的地址,而char型存储的是内容,所以不可以直接用赋值号赋值 */ const char* a = "hello"; string b = a; //正确 con 阅读全文
posted @ 2020-02-26 08:52 Daybreaking 阅读(41971) 评论(0) 推荐(5) 编辑
摘要: 题目描述 乐羊羊饮料厂正在举办一次促销优惠活动。乐羊羊C型饮料,凭3个瓶盖可以再换一瓶C型饮料,并且可以一直循环下去(但不允许暂借或赊账)。请你计算一下,如果小明不浪费瓶盖,尽量地参加活动。那么,对于他初始买入的n瓶饮料,最后他一共能喝到多少瓶饮料。 输入 输入存在多组测试数据每组测试数据输入一行包 阅读全文
posted @ 2020-01-28 12:21 Daybreaking 阅读(780) 评论(0) 推荐(0) 编辑
摘要: I was trying to solve problem '1234 - Harmonic Number', I wrote the following code long long H( int n ) { long long res = 0; for( int i = 1; i <= n; i 阅读全文
posted @ 2019-11-25 18:34 Daybreaking 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 一般解法 算法思路: 对于所有的位置,判断能不能放; 能放就放,处理; 不可行,回溯; 剪枝: 不能在同一行 deep++; 不能在同一列 不能在同一斜线 check k; for(i = 1; i <= deep; i++) col[i] != k; //同列 abs(i - deep) != a 阅读全文
posted @ 2019-10-29 10:54 Daybreaking 阅读(252) 评论(1) 推荐(1) 编辑
上一页 1 2 3 4 5 6 ··· 13 下一页