![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
acm
binggo1226
这个作者很懒,什么都没留下…
展开
-
文章标题
/* 1.唯一分解定理 任何一个数都可以分解为从小到大质数(相同质数可以写成指数形式)的连续乘法 2. x/y为整数 当且仅当x的部分质数将y的全部质数消掉 x=x1*x2*x3 x/y为整数((x1/y)*x2*x3),当且仅当y与x1,x2,x3的最大公约数消去后为1 3.a=p1^e1*p2^e2*p3*pn^en b=p1^f1*p2^f2*p3^f3*pn^fn gcd(a,b)=p1^m原创 2016-08-05 10:39:28 · 184 阅读 · 0 评论 -
int的极值
(1<<31)-1 和-((1<<31)-1)原创 2017-03-13 22:25:09 · 345 阅读 · 0 评论 -
acm输入外挂
inline void scan_d(int &ret) { char c; ret = 0; while ((c = getchar()) < '0' || c > '9'); while (c >= '0' && c <= '9') { ret = ret * 10 + (c - '0'), c = getchar(); } } 居原创 2017-03-13 17:46:49 · 350 阅读 · 0 评论 -
二分答案,lowerbound
#include<iostream> #include<algorithm> #include<cstdio> using namespace std; const int maxn = (int) 1e5 + 7; int A[maxn]; int binT[maxn]; int m;bool check(int x,int n) { int cnt = 0; for (int i转载 2017-03-05 12:47:14 · 234 阅读 · 0 评论 -
逆向操作堆栈
#include<iostream> #include<stack> #include<cstdio> #include<cstring> using namespace std; typedef long long LL; const int maxn = (int)1e5 + 7; LL A[maxn]; LL Q[maxn][5]; LL gcd(LL x, LL y) { while原创 2017-03-05 12:45:58 · 393 阅读 · 0 评论 -
贪心
#include<iostream> using namespace std; int main() { int T; cin >> T; while (T--) { int N, M; cin >> N >> M; if (M == 1&&N==1) { cout << 1 <<原创 2017-03-05 12:44:51 · 429 阅读 · 0 评论 -
分治求逆序数
#include<iostream> using namespace std; const int maxn = (int) 1e5 + 7; int A[maxn]; int T[maxn]; long long ans = 0; void merge_sort(int x, int y) { if (y - x > 1) { int m = (x + y) >>转载 2017-03-05 12:44:02 · 255 阅读 · 0 评论 -
答案二分,lowerbound,upperbound
#include<iostream> #include<algorithm> #include<cstdio> using namespace std; typedef long long LL; const int maxn = (int) 1e5 + 7; int A[maxn]; int d;基本思路: 由于绝对值在0到max(A[i])(i>=0,i<n)中 所以只要在0-100000000转载 2017-03-05 12:41:53 · 284 阅读 · 0 评论 -
区间覆盖
#include<iostream> #include<cstring> using namespace std; const int maxn = (int)1e5 + 7; long long D[maxn]; int main() { int n; while (cin >> n&&n) { int m; cin >> m;转载 2017-03-05 12:39:28 · 312 阅读 · 0 评论 -
矩阵快速幂
#include<iostream> #include<cstring> using namespace std; const int maxn = (int)1e3 + 7; int A[maxn][6]; int B[6][maxn]; int C[maxn][6]; struct node { int M[6][6]; }; node BA;node cheng(int m,int n转载 2017-03-05 12:38:26 · 226 阅读 · 0 评论 -
POJ1837
//定义状态:dp[i][j] //i表示目前使用了几个砝码 //j表示天平目前的平衡状态 //dp[i][j]该状态出现几次 #include<iostream> #include<cstdio> #include<string.h> int carr[20 + 5]; int garr[20 + 5]; #define rep(i,n) for(int i=0;i<(n);i++) const原创 2016-08-03 13:29:46 · 157 阅读 · 0 评论 -
upper_bound无法用在结构体重
这里写代码片原创 2017-03-17 12:42:49 · 302 阅读 · 0 评论