摘要:
维护一个单调栈,如果当前的高度小于栈顶的,则弹栈,直到当前的高度大于栈顶,将当前的入栈。要注意高度为0的情况,开始忘考虑了,WA了一次。/* * hdu1008/win.cpp * Created on: 2012-7-24 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <iostream>#include <algorithm>#inc 阅读全文
摘要:
一看就可以用母函数做,不过好久没练DP了,所以还是用DP做了。用dp[i][j]表示前i种石头排出j个出来的种数,当考虑第i种石头石,枚举其使用的个数即可。WA了好几次,是整数相乘精度的问题,使用long long就过了。/* * hdu1004/win.cpp * Created on: 2012-7-24 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include < 阅读全文
摘要:
罗马数字转阿拉伯数字,还只限12以内的。。。还有更水的赛题么。。/* * hdu1012/win.cpp * Created on: 2012-7-24 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <iostream>#include <algorithm>#include <queue>#include <set&g 阅读全文
摘要:
挺水的,边长肯定是最大的箱子的边长加上次大的箱子的边长/* * hdu1003/win.cpp * Created on: 2012-7-24 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <iostream>#include <algorithm>#include <queue>#include <set>#in 阅读全文
摘要:
水题,不说什么了。/* * hdu1001/win.cpp * Created on: 2012-7-24 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <iostream>#include <algorithm>#include <queue>#include <set>#include <map># 阅读全文