
ACM模板
ACM模板
_昨日不可追
这个作者很懒,什么都没留下…
展开
-
高精度
转载原地址转载 2019-10-22 20:32:17 · 277 阅读 · 0 评论 -
线段树模板题
洛谷3373三种操作1,区间乘2,区间加3,查询区间和#include <bits/stdc++.h>using namespace std;typedef long long ll;const int N=4e5+7;ll p,n,m;ll a[N],lazy[N],tr[N],lazyc[N];void Add(ll i,ll l,ll r,ll k){...原创 2019-07-03 13:46:39 · 225 阅读 · 0 评论 -
矩阵快速幂
N=2;//矩阵大小ll quick(ll a,ll b){//快速幂 ll ans=1; while(b){ if(b&1)ans=ans*a%mod; a=a*a%mod; b/=2; } return ans%mod;}struct sa{ ll m[N][N];};sa Mul(...原创 2020-03-06 20:58:59 · 183 阅读 · 0 评论 -
I Hate It(hdu 1754线段树)
题目Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0<N<=...原创 2019-07-20 20:58:54 · 122 阅读 · 0 评论 -
欧拉函数的应用(hdu 3501)
原题链接Given a positive integer N, your task is to calculate the sum of the positive integers less than N which are not coprime to N. A is said to be coprime to B if A, B share no common positive diviso...原创 2019-11-06 00:16:19 · 172 阅读 · 0 评论 -
A - Beauty Contest(凸包,模版)
传送门#include <iostream>#include <stdio.h>#include <algorithm>#include <string.h>#include <vector>#include <math.h>#include <map>#include <queue>...原创 2019-10-04 20:42:24 · 457 阅读 · 0 评论 -
KMP模版
#include <iostream>#include <stdio.h>#include <algorithm>#include <string.h>#include <vector>#include <math.h>#include <map>#include <queue>#inc...原创 2019-09-25 20:47:03 · 119 阅读 · 0 评论 -
【模板】最近公共祖先(LCA)(luogu p3379)(树上倍增)
https://www.luogu.org/problem/P3379题目描述如题,给定一棵有根多叉树,请求出指定两个点直接最近的公共祖先。输入格式第一行包含三个正整数N、M、S,分别表示树的结点个数、询问的个数和树根结点的序号。接下来N-1行每行包含两个正整数x、y,表示x结点和y结点之间有一条直接连接的边(数据保证可以构成树)。接下来M行每行包含两个正整数a、b,表示询问a结点和b...原创 2019-08-01 16:59:27 · 165 阅读 · 0 评论 -
Mobile phones(poj 1195)二维树状数组模版,更新与查询
Mobile phonesTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 17661 Accepted: 8173DescriptionSuppose that the fourth generation mobile phone base stations in the Tampere area operate ...原创 2019-08-05 14:10:13 · 142 阅读 · 0 评论 -
快读模版
codeforces/1141/快读例子这是大佬的代码QAQ#include<cstdio>#include<algorithm>#include<cctype>#include<cstring>#include<iostream>#include<cmath>#define LL long long#def...原创 2019-03-23 09:01:19 · 424 阅读 · 0 评论