1 本章构建完整的算术逻辑单元ALU。2 有符号的二进制数 1) 补码:x的补码=2的n次方-x,即反码+1 2) 减法可以看成x-y=x+(-y)3 加法器 1) HalfAdder 半加器 /** * Computes the sum of two bits. */ CHIP HalfAdder ...
分类:
其他好文 时间:
2016-10-08 01:49:34
阅读次数:
460
1.位与(&)操作,计算十进制数中的为“1”的位数 PS:关于位的操作补充:C++ bitset类 (1)bitset定义及初始化 (2)bitset操作(bitset<32> bitvec; // 32 bits, all zero) 把b中的位集输出到os流 bitset<32> bitvec2 ...
分类:
编程语言 时间:
2016-10-07 23:02:17
阅读次数:
223
题目链接:http://hihocoder.com/problemset/problem/1032 #include <bits/stdc++.h> using namespace std; bool table[10000][10000] = {false}; string longestPali ...
分类:
其他好文 时间:
2016-10-06 22:43:01
阅读次数:
185
题意:dp[n] = ∑ ( dp[n-i]*a[i] )+a[n], ( 1 <= i < n) cdq分治。 计算出dp[l ~ mid]后,dp[l ~ mid]与a[1 ~ r-l]做卷积运算。 1 #include <bits/stdc++.h> 2 using namespace std ...
分类:
其他好文 时间:
2016-10-06 00:11:47
阅读次数:
186
1、CF #375 (Div. 2) D. Lakes in Berland 2、总结:麻烦的bfs,但其实很水。。 3、题意:n*m的陆地与水泽,水泽在边界表示连通海洋。最后要剩k个湖,总要填掉多少个湖,然后输出。 #include<bits/stdc++.h> #define F(i,a,b) ...
分类:
其他好文 时间:
2016-10-05 17:54:11
阅读次数:
183
#include<bits/stdc++.h> using namespace std; #define ll long long #define pi (4*atan(1.0)) #define eps 1e-14 const int N=2e5+10,M=4e6+10,inf=1e9+10,mo ...
分类:
其他好文 时间:
2016-10-05 17:33:06
阅读次数:
150
1、CF #374 (Div. 2) D. Maxim and Array 2、总结:按绝对值最小贪心下去即可 3、题意:对n个数进行+x或-x的k次操作,要使操作之后的n个数乘积最小。 (1)优先队列 #include<bits/stdc++.h> #define F(i,a,b) for (in ...
分类:
其他好文 时间:
2016-10-05 17:28:00
阅读次数:
127
简单的分数运算,签到题 #include<bits/stdc++.h> using namespace std; int p[15],q[15]; int gcd(int a,int b){return b==0?a:gcd(b,a%b);} int lcm(int a,int b){return ...
分类:
其他好文 时间:
2016-10-04 18:55:55
阅读次数:
170
1002.公式,手算一下就能找到两个式子的关系,迭代一下就行。 1 #include <bits/stdc++.h> 2 using namespace std; 3 4 const int maxn = 9; 5 int a[maxn], b[maxn]; 6 int n, p, q; 7 8 i ...
分类:
其他好文 时间:
2016-10-04 18:24:50
阅读次数:
433
#include <cstdio> #include <queue> #include <algorithm> #include <string.h> //#include <bits/stdc++.h> using namespace std; const int maxn=100000; int ...
分类:
其他好文 时间:
2016-10-04 11:48:44
阅读次数:
210