![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
hongrock
这个作者很懒,什么都没留下…
展开
-
Codeforces —— 359C Prime Number
#include #include #include using namespace std; #define MOD 1000000007 #define LL __int64 int n, i; LL a[100000], x, s, cnt, t, r; map MP; map::iterator it; void solve(){ LL ans=1; while(s>0){ if(原创 2013-11-05 14:25:13 · 1789 阅读 · 2 评论 -
ZOJ 3758 —— Singles' Day
题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5203 给一个b和一个n,m就是写成b进制的n个1,然后如果m是质数就输出YES,否则NO。 由于b和n最多只有16,而m相当于1+b+b^2+...+b^(n-1) 就算b和n都取16也不会超过long long; 我的做法是先求出所有的取值:f[b][n];原创 2014-03-02 18:21:48 · 835 阅读 · 2 评论 -
HDU 3792——Twin Prime Conjecture(数论)
求不大于N的孪生素数的对数,孪生素数就是相差为2的一对素数。 因为N a数组清0,a[i]=1则表示i和i-2都是素数。 用素数筛法标记出所有素数,同时,每找到一个素数i,就判断i-2是否也是素数,是的话就把a[i]赋值为1。 最后求出所有前缀和就Ok了。 #include #include int a[100010], s[100010]; bool f[100010]; int n,原创 2014-03-26 11:35:28 · 754 阅读 · 0 评论 -
HDU 4992 Primitive Roots(求出n的所有原根)
题目:Primitive Roots原创 2014-09-10 11:56:12 · 2406 阅读 · 1 评论 -
ZOJ 2523 —— Number of People(数论,胡搞)
题目:Number of People 题意:N个人开party还原创 2014-08-17 11:10:11 · 530 阅读 · 0 评论