随笔分类 -  数论

 
HRBUST 1328 相等的最小公倍数
摘要:http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=1328判断n因式分解后是否是a^b的形式,是则输出NO,反之YESView Code #include <stdio.h>#include <math.h>#include <stdlib.h>#include <string.h>int jj(int n){ int i,f1=0,f2=0,t; t=n; for(i=2;i<t;i++) { if(!f1) { if(n%.. 阅读全文
posted @ 2012-04-06 00:50 LegendaryAC 阅读(188) 评论(0) 推荐(0)
HDU 1215 七夕节
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1215求N因子的和,从1找到sqrt(n),成对的找,后面的用前面的除View Code #include <stdio.h>#include <string.h>#include <math.h>#include <stdlib.h>int gao(int n){ int s=0,i,cc; cc=sqrt(n); for(i=1;i<=cc;i++) if(n%i==0&&n/i>cc&&n/i!=n) s+=(i 阅读全文
posted @ 2012-04-05 23:04 LegendaryAC 阅读(240) 评论(0) 推荐(0)
HDU 2601 An easy problem
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=26012932MS......好险注意:(1)n的数据范围(2)j>=i(3)开方拿出来算因为上面三点挂了几次,勉强过关View Code #include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>int main() { __int64 n; int t,i,p; int cnt; scanf("%d",&t); while(t--) { 阅读全文
posted @ 2012-04-05 11:43 LegendaryAC 阅读(256) 评论(0) 推荐(0)
HDU 4143 A Simple Problem
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4143两个for枚举肯定超时,移项因式分解后,只要一个for枚举(y-x)就好了,(y+x)用n去除(y-x)。另外两个小点,关注到(y-x)一定小于等于sqrt(n),并且(y-x)与(y+x)不相等View Code #include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>int main() { int t,n; int i; int f; scanf("% 阅读全文
posted @ 2012-04-05 11:18 LegendaryAC 阅读(257) 评论(0) 推荐(0)