摘要: 链接:http://acm.hdu.edu.cn/showproblem.php?pid=1395思路: 由题意得N=2^x(x>=1)为偶数, 所以当 n 也为偶数时 N%n必为偶数, 故不存在;当n为奇数时,利用同余定理求;View Code 1 #include <iostream> 2 #include <cstdio> 3 #include <string> 4 #include <cstring> 5 #include <cmath> 6 using namespace std; 7 8 int main( ) 9 阅读全文
posted @ 2013-01-08 22:09 淡墨æ末央 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 链接:http://acm.hdu.edu.cn/showproblem.php?pid=1262View Code 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <math.h> 4 int a[10005]={0}; 5 void fun( ) 6 { 7 a[1]=a[0]=1; 8 for( int i=4; i<10005; i+=2 ) 9 a[i]=1;10 for( int i=3; i <= ( int )sqrt( 10005 ); i+=2 )11 {12 ... 阅读全文
posted @ 2013-01-08 22:02 淡墨æ末央 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 链接:http://acm.hdu.edu.cn/showproblem.php?pid=1576思路:由题意可知,一定有解,而且解空间很小, 故可以枚举;M=9983, n=A%M gcd( b,M )==1, ans=(A?B)%M,则 n == (ans*b)%M;因为: A%M == (A/B*B)%M==(A/B%M * B%M)%M== (ans*B%M)%M;View Code 1 #include <iostream> 2 #include <cstdio> 3 #include <string.h> 4 using namespace st 阅读全文
posted @ 2013-01-08 21:58 淡墨æ末央 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 链接:http://acm.hdu.edu.cn/showproblem.php?pid=4279题意:给定一个数N, 在[1,N)中的数M, gcd( M, N ) != 1, 且N%M != 0; 那么M就为N的一个special number, f( x ) 为统计 x 的special number的个数, 如果f( x )为奇数,那么x就为一个real numbers. 求给定区间的realnumber数.思路:先看f(x),由题意得f(x)=x-phi( x ) - g(x)+1;( phi(x)为欧拉函数, g(x)为因子个数, +1 是因为1在phi(x)和g(x)中都算了 ) 阅读全文
posted @ 2013-01-08 21:21 淡墨æ末央 阅读(188) 评论(0) 推荐(0) 编辑