问题引出:我们都知道宏定义#define只是简单替换,所以遇到复杂的带参数宏,必须很小心的为需要的参数加上括号“()”;同样碰到复杂的多条语句替代,虽然加{}可以将其封装成一个整体,但同时又有另一个问题:与语法习惯的冲突。比如:#include void print_1(void){printf("...
分类:
编程语言 时间:
2014-08-07 12:52:09
阅读次数:
223
#includeusing namespace std;int main(){ int n=1; double s=0; do//先执行一次循环体 { s=s+(1.0/n); n++; }while(s<8.0); cout <<"s...
分类:
其他好文 时间:
2014-08-07 12:47:09
阅读次数:
716
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5235这道题需要构造矩阵:F(X)=F(X-1)+F(X-2)*A(X)转化为F(X)*A(X+2)+F(X+1)=F(X+2),然后在构造矩阵{1, A[x]} {F(x+1)}...
分类:
其他好文 时间:
2014-08-07 12:44:10
阅读次数:
229
题目: Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see be....
分类:
编程语言 时间:
2014-08-07 12:08:49
阅读次数:
260
By default, the action bar appears at the top of your activity window, slightly reducing the amount of space available for the rest of your activity's layout. If, during the course of user interaction, you want to hide and show the action bar, you can do s...
分类:
移动开发 时间:
2014-08-07 03:07:19
阅读次数:
344
Problem DescriptionDuring summer vacation,Alice stay at home for a long time, with nothing to do. She went out and bought m pokers, tending to play po...
分类:
其他好文 时间:
2014-08-06 22:52:52
阅读次数:
326
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4439题意:n个点的有向无环图,边有长度,从一个点到另一点消耗背包重量与边长的乘积。每个点卖物品,价值v,重量w,数量无限,给定起点,和背包容量,可以在任意点停止,问最大化所获得价...
分类:
其他好文 时间:
2014-08-06 22:31:32
阅读次数:
290
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4257
难度远不及我之前发的...
但是我第一次的思路竟然错了,因为dp方程想设计成二维,但是弄错,也没发现原因,,,
改为一维:dp[s]:状态为s的时候,得到的最大能量,其中s第i位为1表示,i已经被撞毁
#include
#include
#include ...
分类:
其他好文 时间:
2014-08-06 19:02:42
阅读次数:
250
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3181题意:就是混合背包加分组背包,有的物品是01背包,有的是多重背包,有的是完全背包,同时物品还有不超过8组的分组,如果在同一组则最多只能选一种。问能不能恰好地用掉D的容量,并且...
分类:
其他好文 时间:
2014-08-06 17:49:11
阅读次数:
252
昨天在开发windows phone 8.1程序时,发现程序在挂起的时候,会自动退出。通过调试发现错误信息是System.Runtime.InteropServices.COMException (0x80004005): Unspecified errorGetNavigationState do...
分类:
移动开发 时间:
2014-08-06 17:35:31
阅读次数:
333