随笔分类 -  数论

摘要:gcd裸题,不过输入要注意gets会tle,要用快速读入 #include<map> #include<set> #include<cmath> #include<queue> #include<stack> #include<vector> #include<cstdio> #include<ca 阅读全文
posted @ 2017-07-20 16:48 walfy 阅读(189) 评论(0) 推荐(0)
摘要:题目:http://acmoj.shu.edu.cn/problem/418/ 素数筛一边,二维sg先预处理出sg值,然后O(1)查询 1必胜,2必败 #include<map> #include<set> #include<cmath> #include<queue> #include<stack 阅读全文
posted @ 2017-07-11 13:14 walfy 阅读(212) 评论(0) 推荐(0)
摘要:Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a given positive integ 阅读全文
posted @ 2017-04-23 15:15 walfy 阅读(125) 评论(0) 推荐(0)
摘要:C. Mike and gcd problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mike has a seque 阅读全文
posted @ 2017-04-22 13:55 walfy 阅读(177) 评论(0) 推荐(0)
摘要:https://vjudge.net/contest/70017#problem/E 后半部分快速幂就能求出来,要注意03lld不然001是输出错误为1.前半部分用log10() 对于给定的一个数n,它可以写成10^a,其中这个a为浮点数,则n^k=(10^a)^k=10^a*k=(10^x)*(1 阅读全文
posted @ 2017-03-05 16:45 walfy 阅读(147) 评论(0) 推荐(0)
摘要:做了半天都是超时,一直在想怎么用位运算减少时间,最后无奈看答案,发现居然有公式!!! 数论的题目好多都是套格式,知道公式一步到位,不知道想到死都想不出来 阅读全文
posted @ 2017-03-04 20:33 walfy 阅读(119) 评论(0) 推荐(0)