- 博客(7)
- 资源 (2)
- 收藏
- 关注
原创 HDU 1286 找新朋友
Sol:欧拉函数的应用。。。。 #include #include using namespace std; const int maxisp = 1000 + 10; const int maxp = 500 + 10; int num,n; int prime[maxp]; int isprime[maxisp]; inline v
2014-02-06 17:14:12 723
原创 HDU 2136 Largest prime factor
Sol:筛法求素数打表时预处理下即可。 #include #include using namespace std; const int maxisp = 1000000 + 10; const int maxp = 1000000 + 10; int num,n; int prime[maxp]; int isprime[maxisp]
2014-02-06 17:08:14 671
原创 HDU 1722 Cake
Sol:证明的好题。。。画个图就能推出来重复的次数就是GCD了。 #include #include #include using namespace std; inline int gcd(int a,int b) { return b==0?a:gcd(b,a%b); } int main() { int n,m; while(~scanf("%d%d",&n,&m))
2014-02-06 15:56:12 735
原创 HDU 1713 相遇周期
Sol:求分数的GCD小学生都会。。。注意通分约分就好。 #include #include #include using namespace std; inline long long gcd(long long a,long long b) { return b==0?a:gcd(b,a%b); } inline long long lcm(long long a,long l
2014-02-06 15:39:05 836
原创 HDU 2138 How many prime numbers
Sol: Miller素数即可解答。。。。 #include #include #include #include #include #include using namespace std; const int S = 8;//随即算法判定 long long mult_mod(long long a,long long
2014-02-05 17:28:58 618
原创 HDU 2029 Palindromes _easy version
Sol:一个数异或两次等于没操作。这题跟12年东北赛一题很像。。。 #include using namespace std; inline void scan(int &x) { char c; while(c=getchar(),c'9'); x=c-'0'; while(c=getchar(),c>='0'&&c<='9') x
2014-02-05 17:00:36 670
原创 HRBUST 2024 Strange fuction || HDU 2899 Strange fuction
Sol:求函数的最小值。求两次导数,判断函数的单调性和凹凸性即可,用二分查找即可。 #include #include using namespace std; const double eps = 1e-10; int T; double y; double G(double x) { return 42*pow(x,6)+48*pow(x,5)+21*pow(x,2)+1
2014-02-03 22:15:00 676
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人