/** * 线性筛法求素数表 * 复杂度: O(n) */ const long MAXP = 1000000; long prime[MAXP] = {0},num_prime = 0; int isNotPrime[MAXP] = {1, 1}; void GetPrime_Init()//初始化调用 { for(long i = 2 ; i < MAXP ; i ++) { if(!

又是我们的OJ 题目链接: http://www.cn210.com/onlinejudge/problemshow.php?pro_id=92 Description tancu likes space travels but he is a poor software developer and will never be able to buy his own spacecraft. That is why he is preparing to steal the spacecraft of Petru. There is only one problem - Petru has locked the spacecraft with a sophisticated cryptosystem based on the ID numbers of the stars

http://www.cn210.com/onlinejudge/problemshow.php?pro_id=98 我们的OJ Description We say that a set S = {x1, x2, ..., xn} is factor closed if for any xi ∈ S and any divisor d of xi we have d ∈ S. Let's build a GCD matrix (S) = (sij), wheresij = GCD(xi, xj) - the greatest common divisor of xi and xj. Given the factor closed set S, find the value of the determinant:    Input The input contains several test cases. Each test case starts with an integer n (0 < n < 1000), that stands for

链接: http://acm.pku.edu.cn/JudgeOnline/problem?id=1141 题目意思是输入一些括号,补充括号使之成为没有错误的括号就是只能有括号组在括号组里面,不能出现([)]或者([)]一类的情况 方法是DP

这道题是我专门为了了解和学习树状数组而写的 这题用树状数组记录翻转次数,然后mod一个2,也可以不断地取反 还要用到二维的树状数组.于是我专门写

注册表常用键值意义 [HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Control Panel] ;〖Internet Explorer选项类〗 “HomePage”=dword:00000001 ;禁止更改主页设置〖0=可修改〗 “Cache”=dword:00000001 ;禁止更改Internet临时文件设

/** * Hash模板 * Based: 0 * template<unsigned long _SZ,class _T, unsigned long *pFun(_T _Off)> * class _My_Hash_ToInt * 传入数据大小_SZ,传入类型_T,Hash函数 * 传入类型_T必须重载 = 和 == 符号 * 收录了ELF

题目: http://acm.hdu.edu.cn/showproblem.php?pid=3336 水题一道,主要是测试数据很水 不解释,贴代码: #include <iostream> #include <cstdio> #include <vector> #include <cstring> using namespace std; char str[200005]; vector<long>glo_Pos; int main() { int t; long output,i,n,j; scanf("%d",&t); while(t --) { output = 0; glo_Pos.clear(); scanf("%ld %s", &n, str); for(i = 0; i < n; i ++) { if(str[i] ==

为什么我用线段数这么不灵活呢? 大概思路是线段数记录某牛之前的坐标小于这个牛的牛的坐标和和牛的个数 然后其他部分线性数组记录 OK,贴代码 #include <iostream> #include <cstdio>