
数论
芋智波佐助
菜鸟一只
展开
-
TOJ 4099 组队要和谐
组队要和谐 时间限制(普通/Java):1000MS/1000MS 运行内存限制:65536KByte总提交: 19 测试通过: 4 描述为了备战明年的省赛。我们煞费苦心的crq教练打算从众多大一的ACMER中组织一个主力队伍。众所周知,大一新生中人才济济,有N个人都有可以参加省赛的实力,为了安排合适的组合。crq教练开始研究这 N 个原创 2013-08-17 19:42:24 · 1065 阅读 · 0 评论 -
UVa 11121 Base -2 / 进制转换
-2 进制 % -2 结果是 -1 0 1感觉这个会了任意负进制都会了http://www.cnblogs.com/scau20110726/archive/2012/12/21/2828420.html 解释的蛮好的#include int n;int main(){ int cas = 1,n,k,t,i; int a[100]; scanf("%d",&t原创 2013-12-05 20:27:35 · 1021 阅读 · 0 评论 -
POJ 3047 Bovine Birthday 给出年月日求星期 蔡勒公式
题目来源:POJ 3047 Bovine Birthday题意:。。。思路:蔡勒公式 适合于1582年(中国明朝万历十年)10月15日之后的情形公式 w = y + y/4 + c/4 - 2*c + 26 * (m+1)/10 + d - 1;m如果是1 2 月份 y要倒退1年 m += 12y是年份的后两位 y = year%100c是世纪 c = year/100原创 2014-05-10 15:53:20 · 1241 阅读 · 0 评论 -
Light OJ 1054 Efficient Pseudo Code 求n^m的约数和
题目来源:Light OJ 1054 Efficient Pseudo Code题意:求n的m次这个数的所有的约数和思路:首先对于一个数n = p1^a1*p2^a2*p3^a3*…*pk^ak 约束和s = (p1^0+p1^1+p1^2+…p1^a1)(p2^0+p2^1+p2^2+…p2^a2)…(pk^0+pk^1+pk^2+…pk^ak)然后就是先求素数表 分解因子 然后求原创 2014-05-20 19:59:34 · 1099 阅读 · 0 评论 -
Light OJ 1234 Harmonic Number 调和级数部分和
题目来源:Light OJ 1234 Harmonic Number题意:思路:没思路啊 这个是高数的东西 发散 n足够大时它无穷大 直接公式解#include #include #include #include #include #include using namespace std;const int maxn = 1000010;const doub原创 2014-05-24 16:25:29 · 1249 阅读 · 0 评论 -
POJ 2480 Longge's problem 积性函数
题目来源:POJ 2480 Longge's problem题意:求i从1到n的gcd(n, i)的和思路:首先如果m, n 互质 gcd(i, n*m) = gcd(i, n)*gcd(i, m) 这是一个积性函数积性函数的和还是积性函数由欧拉函数知识得 phi(p^a) = p^a - p^(a-1) p是素数 a是正整数得到最终答案f(n) = f(p1^a1原创 2014-08-30 10:08:40 · 938 阅读 · 0 评论 -
UVa 128 Software CRC / 进制转换
给你一个字符串 他是一个256进制的数 求一个数加到它末尾使得 % 34943 等于0不能直接把字符串直接转换成10进制 大数因为只要求余数ans rhou mod - ans 就是所求的数一边转 一边除 最后的余数直接在转成16进制#include #include #include #include using namespace std;char a[2原创 2013-12-10 14:32:41 · 1018 阅读 · 0 评论 -
ZOJ 1005 POJ 1606 Jugs /数论
JugsTime Limit: 2 Seconds Memory Limit: 65536 KB Special Judge In the movie "Die Hard 3", Bruce Willis and Samuel L. Jackson were confronted with the following puzzle. They were gi转载 2013-08-26 19:15:39 · 848 阅读 · 0 评论 -
TOJ 3053 OJ 2244 ZOJ 1088 System Overload / 约瑟夫
System Overload 时间限制(普通/Java):1000MS/3000MS 运行内存限制:65536KByte描述Recently you must have experienced that when too many people use the BBS simultaneously, the net becomes very, very s原创 2013-08-25 20:11:48 · 1109 阅读 · 0 评论 -
TOJ 4351 HDU 4259 Double Dealing
Double Dealing 时间限制(普通/Java):20000MS/60000MS 运行内存限制:65536KByte 描述Take a deck of n unique cards. Deal the entire deck out to k players in the usual way: the top card to player 1,原创 2013-10-21 15:46:47 · 1289 阅读 · 0 评论 -
TOJ 2909 ZOJ 3175 Number of Containers / 数论
Number of Containers时间限制(普通/Java):1000MS/3000MS 运行内存限制:65536KByteFor two integers m and k, k is said to be a container ofm if k is divisible by m. Given 2 positive integers n and转载 2013-11-14 16:11:53 · 1221 阅读 · 0 评论 -
UVa 138 Street Numbers / 佩尔方程
求 一组解 x y使得 1 + 2 + ... + x-1 = x+1 + x+2 +... + y(x不算)可以写成2*x*x = y*y+y的形式 化成佩尔方程求解懒了 搞了个打表#include int main () { printf (" 6 8\n"); printf (" 35 49\n原创 2013-12-06 14:09:03 · 1120 阅读 · 0 评论