贪心,如果m分成的两个区间长度不相等,那么选长的那个区间最接近m的位置,否则选m-1位置,特判一下n等于1的情况#includeusing namespace std;int main(){ int n,m; scanf("%d%d",&n,&m); if(n == 1){ ...
分类:
其他好文 时间:
2015-08-14 06:26:52
阅读次数:
78
题解:
对于新插入的线段,查询有多少个线段左端点大于等于该线段的左端点。 再查询有多少个线段的右端点大于该线段右端点, 两者之差就是答案。
这里注意两个问题,一个是离散化,第二个这道题时间卡的可能比较严,线段树貌似会超时~
好久没写离散化了。。。生疏了
#include
#include
#include
using namespace std;
const int max...
分类:
编程语言 时间:
2015-08-14 01:12:25
阅读次数:
119
#include
#include
using namespace std;
struct node
{
int x;//点的坐标
int y;
int s;//记录步数
};
int main()
{
int startx,starty;
int endx,endy;
int tx,ty;
int n,m;
int k;
...
分类:
其他好文 时间:
2015-08-13 23:48:04
阅读次数:
186
#include#include#includeusing namespace std;char num[10000];int get_sum(){ int ret=0; for(int i=0;i<strlen(num);i++) { ret+=(num[i]-'0...
分类:
其他好文 时间:
2015-08-13 23:35:24
阅读次数:
183
看官方题解貌似是个DP
比赛的时候用kuangbin的AC自动机模板瞎搞的,竟然A了,而且跑的还不慢。。
存下模板吧
#include
#include
#include
#include
#include
#include
#include
using namespace std;
const int maxn = 500010;
const int maxd = 26;
struct T...
分类:
其他好文 时间:
2015-08-13 22:26:41
阅读次数:
118
#include
using namespace std;
int book[51][51]={0};
int a[51][51];
int sum;
int n,m;
void dfs(int x,int y)
{
int tx,ty;
int k;
//定义一个方向的数组
int next[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
...
分类:
其他好文 时间:
2015-08-13 22:26:02
阅读次数:
200
#include
using namespace std;
int book[51][51]={0};
int a[51][51];
int sum;
int n,m;
void dfs(int x,int y,int color)
{
int tx,ty;
int k;
//定义一个方向的数组
int next[4][2]={{0,1},{1,0},{0,-1},...
分类:
其他好文 时间:
2015-08-13 22:24:59
阅读次数:
157
线段树节点的左儿子[a,(a+b)/2]右儿子[(a+b)/2,b]
这个很重要
把线段树当成完全二叉树算,开到3*N就可以,但最好是4*N
#include
using namespace std;
int a[50005];
struct {
int sum;
int left,right;
}b[50005*4];
void build(int left,int rig...
分类:
其他好文 时间:
2015-08-13 22:21:51
阅读次数:
122
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
const int maxd=1e5+5;
const int seed=31;
const int I...
分类:
其他好文 时间:
2015-08-13 22:19:15
阅读次数:
152
代码:
#include
#include
#include
using namespace std;
set st[55];
int main()
{
int n,m,k;
while(scanf("%d",&n)==1)
{
double dp[100][100];
for(int i=0; i<55; i++)
{...
分类:
其他好文 时间:
2015-08-13 22:14:39
阅读次数:
105