2012年10月19日
摘要: 题意:求几个最小公倍数为n的数的最小和1、每个素因子组成的最大数加,如:12=(2*2)+ 32、区分单个素因子16=(2*2*2*2)+13、素因子只有1和本身的7=1+7=8,即本身是素数。CODE:#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<algorithm>#include<ctype.h>usingnamespacestd;longlongn;longlongs 阅读全文
posted @ 2012-10-19 22:37 有间博客 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 大意:判断一个256进制数增加2个字节(16位)是否可以被32493整除。说实话,真难看懂题意。CODE:#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<algorithm>#include<ctype.h>usingnamespacestd;#defineMAXN1050charstr[MAXN];intmain(){charsave[8];longlongres=0,ans 阅读全文
posted @ 2012-10-19 20:20 有间博客 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 大意:判断是否是一个特定的数字。思路:按照题目的要求写就行,枚举+判断是否是素数。CODE:#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<algorithm>usingnamespacestd;#defineMAXN65100intvis[MAXN]={0};intprime[MAXN]={0};intn,tot;voidinit(){tot=0;intSIZE=(int)sqrt(MA 阅读全文
posted @ 2012-10-19 15:03 有间博客 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 大意:给你一些加油站A的坐标,一些需要基地B的坐标,问你这两者之间的最小值。思路:用一个标记来表示分别在A和B中,数组长度变大了两倍,然后就是最近点对模板题啦。另外:输出是%.3f,我用%.3lf就WA。CODE:#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<algorithm>usingnamespacestd;#defineMAXN100010constintINF=1e50;str 阅读全文
posted @ 2012-10-19 11:25 有间博客 阅读(762) 评论(0) 推荐(0) 编辑
摘要: 大意:广场上固定着一些玩具,让你设计一个圆环使得最多只有一个玩具落入环中。(使得圆环具有最大半径)思路:去寻找最近的一个对点,它们之间的距离/2就是圆环的最大半径。最近点对模板题.CODE:#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<algorithm>usingnamespacestd;#defineMAXN100010structnode{doublex,y;}p[MAXN*2], 阅读全文
posted @ 2012-10-19 11:18 有间博客 阅读(186) 评论(0) 推荐(0) 编辑