随笔分类 -  数论

摘要:#include#include#includeusing namespace std;char num[10000];int get_sum(){ int ret=0; for(int i=0;i<strlen(num);i++) { ret+=(num[i]-'0... 阅读全文
posted @ 2015-08-13 23:20 sola94 阅读(114) 评论(0) 推荐(0) 编辑
摘要:题意:有一个数列 seed[x+1]=(seed(x)+step)%mod 给出 step 和 mod 如果求出的是以 1。。。mod-1 为循环节的数列 则为 good choice 否则 则是 bad choice思路:1.用标记法 如果 形成循环节时 每个数都被标记到 则good choice... 阅读全文
posted @ 2015-07-18 10:43 sola94 阅读(118) 评论(0) 推荐(0) 编辑
摘要:#include#include#include#include#include#include#include#include#includeusing namespace std;int dir4[][2]={{0,1},{1,0},{0,-1},{-1,0}};int dir8[][2]={{... 阅读全文
posted @ 2015-05-05 21:31 sola94 阅读(220) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/diy/contest_showproblem.php?cid=18447&pid=1001已经过了时间不知道能不能ac 不过思路应该是没错的题意:给定A,B,C,计算(A^(B^C))%100000007 (已知100000007是素数)思路:费马小定理... 阅读全文
posted @ 2015-05-05 21:13 sola94 阅读(253) 评论(0) 推荐(0) 编辑
摘要:题意:思路:#include#include#include#include#include#include#includeusing namespace std;int a[35],n,m;int main(){ while(~scanf("%d%d",&n,&m)) { ... 阅读全文
posted @ 2015-04-21 11:29 sola94 阅读(143) 评论(0) 推荐(0) 编辑
摘要:题意:思路:#include#include#include#include#include#include#include//const int maxn;using namespace std;char s[1000];int num[5];int main(){ int n; in... 阅读全文
posted @ 2015-04-21 11:27 sola94 阅读(119) 评论(0) 推荐(0) 编辑
摘要:题意:给定一组数,取两个数,使得gcd最大c思路:#include#include#include#includeusing namespace std;#define ll __int64//#define ll long longint vis[100000+100];int gcd(int a... 阅读全文
posted @ 2015-04-19 00:08 sola94 阅读(166) 评论(0) 推荐(0) 编辑
摘要:题意:输入一个数x 从小到大输出所有满足 (k*leny+y)*x=y*10+k 的k*leny+y思路:因为x 为浮点数 所以等式两边都要乘 1e4 将等式化为 k(leny*x-1)*1e4=y(1e5-x*1e4) 可以通过枚举 len k 来求出y是否存在 存在时位数又是否符合条... 阅读全文
posted @ 2015-04-05 02:48 sola94 阅读(125) 评论(0) 推荐(0) 编辑
摘要:题意:求出1^m+2^m+...n^m思路:直接套用模板#include#include#include#include#include#include#include#include#include#define LL long longusing namespace std;const LL m... 阅读全文
posted @ 2015-03-29 23:31 sola94 阅读(150) 评论(0) 推荐(0) 编辑
摘要:http://acm.csu.edu.cn/OnlineJudge/showsource.php?id=97625#include#include#include#includeusing namespace std;int a[200000];int main(){ int n,m; int ... 阅读全文
posted @ 2015-03-15 21:09 sola94 阅读(164) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1320题意:两个水瓢 A B 容量都为 1 有一个容积无限的水缸 用A 往水缸中倒水 用B 把水缸中的水舀出 必须使用N次A和N次B 问 有多少种方法卡特兰数的应用令h(0)=1,h(1)=... 阅读全文
posted @ 2014-09-07 19:32 sola94 阅读(147) 评论(0) 推荐(0) 编辑
摘要:题意 : 求n个数的最小公倍数思路: 这题直接枚举是不可能的 所以想到了一遍输入一边计算 把每次的gcd给除掉 并相乘 得到的就是lcm sum=sum*a/(gcd(sum,a));#include#include#include#include#include#includ... 阅读全文
posted @ 2014-08-20 01:38 sola94 阅读(108) 评论(0) 推荐(0) 编辑
摘要:题意:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7. 求 f(n)思路:这题根据公式可以得出规律当出现 1 1时 表示达到循环节点因此可以打表求余得出结果但是至于为什么49 是最大周期找到了点资料是说每个数是有前两... 阅读全文
posted @ 2014-08-20 01:30 sola94 阅读(234) 评论(0) 推荐(0) 编辑
摘要:思路: lcm=a*b/gcd(a,b)#include#include#include#include#include#include#include#define mem(a,b) memset(a,b,sizeof(a))#define ll __int64#define MAXN 1000#... 阅读全文
posted @ 2014-08-19 00:16 sola94 阅读(134) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示