ST算法是基于倍增的动态规划算法. #include<iostream> #include<cstdio> #include<cstdlib> #include<cmath> using namespace std; int map[1000005][20]; int N,K; void work() { int i,j; for(j=1;1<<j<=N;j++) for(i=1;i+(1<<j)-1<=N;i++)//i…
题目: http://acm.hdu.edu.cn/showproblem.php?pid=5289 Assignment Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 3175 Accepted Submission(s): 1457 Problem Description Tom owns a company and he i…
Bob’s Race Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4123 Description Bob wants to hold a race to encourage people to do sports. He has got trouble in choosing the route. There are N houses and N - 1 roads…
题目链接 Problem Description Multiple query, for each n, you need to get $$$$$$ \sum_{i=1}^{n} \sum_{j=1}^{i-1}{ [gcd(i + j, i - j) = 1]} $$$$$$ Input On the first line, there is a positive integer T, which describe the number of queries. Next there are…
Summer again! Flynn is ready for another tour around. Since the tour would take three or more days, it is important to find a hotel that meets for a reasonable price and gets as near as possible! But there are so many of them! Flynn gets tired to loo…