1 #include <bits/stdc++.h> 2 #define _xx ios_base::sync_with_stdio(0);cin.tie(0); 3 #define INFS 0x3fffffff 4 #define INFB 0x3fffffffffffffff 5 #defin ...
分类:
其他好文 时间:
2017-05-06 21:55:48
阅读次数:
227
Java基础部分 1 Byte = 8 Bits (细节地方,这个其实跟机器的位数也是有关系。) static 和 fianl 和 finally : 空白final可以被定义,但是必须要在构造器里面或者定义处进行初始化。static是在装载的时候就会被初始化,而non-static的是在装载后才去 ...
分类:
编程语言 时间:
2017-05-06 21:46:39
阅读次数:
200
数论重学篇. 首先需要看出答案是: n!/m!*phi(m!) 小于m!的数中与m!互质的数有phi(m!)个,由辗转相除法可知, gcd(x,m!)=1 <==> gcd(x+m!,m!)=1 然后直接算就行了. 1 #include<bits/stdc++.h> 2 using namespac ...
分类:
其他好文 时间:
2017-05-04 11:06:06
阅读次数:
277
BZOJ4868 每个结束位置的最优值很显然具有单调性,三分,再讨论一下就好了. 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define ll long long 4 #define FILE "exam" 5 #define up(i, ...
分类:
其他好文 时间:
2017-05-03 21:58:14
阅读次数:
267
public class Solution { public int hammingDistance(int x, int y) { return Integer.bitCount(x ^ y); }} bitCount api : Returns the number of one-bits in ...
分类:
其他好文 时间:
2017-05-02 23:41:37
阅读次数:
164
这道题是求组合数终极版. C(n,m) mod P n>=1e9 m>=1e9 P>=1e9且为合数且piqi<=1e5 拓展lucas定理. 实际上就是一点数论小知识的应用. 这篇文章对于CRT和lucas定理的学习非常不错. #include<bits/stdc++.h> using names ...
分类:
其他好文 时间:
2017-05-02 22:14:10
阅读次数:
316
二进制中有多少个1 计算在一个 32 位的整数的二进制表式中有多少个 1. 样例 给定 32 (100000),返回 1 给定 5 (101),返回 2 给定 1023 (111111111),返回 9 挑战 If the integer is n bits with m 1 bits. Can y ...
分类:
其他好文 时间:
2017-05-02 13:58:32
阅读次数:
205
A. 填k个1,使矩阵主对角线对称,相同情况选择上面1数量多的。 #include<bits/stdc++.h> using namespace std; int n,k,a[105][105] = {0}; int main() { ios::sync_with_stdio(false); cin ...
分类:
其他好文 时间:
2017-05-02 10:11:35
阅读次数:
346
1、栈 (1)栈的模拟 特点:先进后出 eg1:火车进站 实际就是模拟一个栈 #include<bits/stdc++.h> using namespace std; const int maxn=1000; int Stack[maxn],a[maxn],stack[maxn],n,l=1; in ...
分类:
其他好文 时间:
2017-05-01 22:15:58
阅读次数:
309
1 #include<bits/stdc++.h> 2 #include <cstdio> 3 #include <iostream> 4 #include <cstring> 5 #include <vector> 6 #define _xx ios_base::sync_with_stdio(0 ...
分类:
其他好文 时间:
2017-05-01 19:45:43
阅读次数:
143