摘要:
读不懂题目的孩子伤不起啊~~~~~~~这题我第一次理解为n的所有约数的立方和,打完一看,样例都不对。。。再读读题,以为是求出n的约数个数x,然后求1^3+2^3+3^3+...+x^3,打完了也能过样例,交上去却WA。。。无奈只好翻别人的解题报告看,才明白题目的意思是求g(n)=∑f(d)^3 (d|n,f(n)表示n的约数个数)易证g(n)为积性函数,即若gcd(n,m)=1则g(nm)=g(n)*g(m)。所以对n分解素因数后N=p1^a1 * p2^a2 ……pj^aj,则可得g(n)=g(p1^a1)*……g(pj^aj)。而对于每个g(p1^a1)=1^3+……(a1+1)^3=(a 阅读全文
摘要:
这题用Java最方便了,直接用Java的正则表达式匹配功能~~~~~~~import java.util.*;import java.util.regex.Matcher;import java.util.regex.Pattern;public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); while(cin.hasNextInt()) { int N = cin.nextInt(); ... 阅读全文
摘要:
用multiset就可以水过,不过我这种方法用int会WA,应该是测试数据中有int的最小值,如果用int保存再取负的话就会溢出,以后要注意~~/* * hdu2275/win.cpp * Created on: 2012-11-2 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <iostream>#include <algorithm> 阅读全文
摘要:
这都是今天做的第三道二分答案的题了。。。这题精度控制要求也比较高,我是把eps设成1e-8才过的1e-6都过不了。。。/* * hdu2199/win.cpp * Created on: 2012-11-2 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <iostream>#include <algorithm>#include < 阅读全文
摘要:
很简单的DP,我用记忆化搜索打的~~/* * hdu2151/win.cpp * Created on: 2012-11-2 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <iostream>#include <algorithm>#include <queue>#include <set>#include < 阅读全文
摘要:
水题,K为64的时候单独处理,其余情况就很easy了。/* * hdu2116/win.cpp * Created on: 2012-11-2 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <iostream>#include <algorithm>#include <queue>#include <set>#in 阅读全文
摘要:
算水题吧,不过这题精度卡得还是挺厉害的,刚开始的时候我是把面积都放大,放大100000000倍,都用long long进行处理,还是过不了,只能用double控制精度了。/* * hdu1969/win.cpp * Created on: 2012-11-2 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <iostream>#include < 阅读全文
摘要:
平衡二叉树就可以,我是用的set。/* * hdu1908/win.cpp * Created on: 2012-11-2 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <iostream>#include <algorithm>#include <queue>#include <set>#include < 阅读全文