摘要: 为了更好的理解状压dp,首先介绍位运算相关的知识。 1.’&’符号,x&y,会将两个十进制数在二进制下进行与运算,然后返回其十进制下的值。例如3(11)&2(10)=2(10)。 2.’|’符号,x|y,会将两个十进制数在二进制下进行或运算,然后返回其十进制下的值。例如3(11)|2(10)=3(1 阅读全文
posted @ 2020-07-04 10:54 特立独行的猪猪 阅读(111) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> #include <algorithm> using namespace std; int main(){ int n; while(scanf("%d",&n)&&n){ int a[1000]; for(int i=0;i<n;i++){ scanf("%d 阅读全文
posted @ 2020-07-04 10:40 特立独行的猪猪 阅读(87) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; typedef long long ll; const int inf = 0x3f3f3f3f; int bok[100]; int path[100]; void dfs(int step) { if(st 阅读全文
posted @ 2020-07-04 09:57 特立独行的猪猪 阅读(128) 评论(0) 推荐(0) 编辑
摘要: gcd(a,b)=gcd(a,b−a) gcd(a,b,c)=gcd(a,b−a,c−b) gcd(a1​,a2​,⋯,an​)=gcd(a1​,a2​−a1​,a3​−a2​,⋯,an​−an−1​) int c = _gcd(a,b); 阅读全文
posted @ 2020-07-03 15:17 特立独行的猪猪 阅读(154) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> typedef long long ll; using namespace std; const int maxn = 2e6+50; ll fac[maxn]; ll inv[maxn]; const int mod = 1e9+7; ll qpow 阅读全文
posted @ 2020-07-02 15:23 特立独行的猪猪 阅读(206) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; typedef long long ll; const int inf = 0x3f3f3f3f; const int maxn = 1e5+50; vector<int>g[maxn]; int n; int 阅读全文
posted @ 2020-07-01 20:46 特立独行的猪猪 阅读(300) 评论(0) 推荐(0) 编辑
摘要: DOM var d1 = document.getElementById("id1"); var d2 = document.getElementsByName("name1")[0]; var d3 = document.getElementsByTagName("p")[1]; d1.inner 阅读全文
posted @ 2020-06-30 21:06 特立独行的猪猪 阅读(182) 评论(0) 推荐(0) 编辑
摘要: printf("%.6f\n",n*n*(pi/2.0-1.0)); // no printf("%.6f\n",(double)n*n*(pi/2.0-1.0)); // yes printf("%.6f\n",(pi/2.0-1.0)*n*n); //yes 阅读全文
posted @ 2020-06-26 17:50 特立独行的猪猪 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 裸题:https://ac.nowcoder.com/acm/contest/5929/B #include<bits/stdc++.h> using namespace std; typedef long long ll; const int inf = 0x3f3f3f3f; int n; st 阅读全文
posted @ 2020-06-26 14:56 特立独行的猪猪 阅读(1331) 评论(0) 推荐(0) 编辑
摘要: 裸题:https://www.luogu.com.cn/problem/P1908 逆序对的个数等于在朴素稳定排序情况下,相邻数交换的次数。 使用归并排序求解 对于ans += mid-ii+1 的理解: #include<bits/stdc++.h> using namespace std; ty 阅读全文
posted @ 2020-06-26 11:04 特立独行的猪猪 阅读(106) 评论(0) 推荐(0) 编辑