摘要: 贪心算法,同类于看电视的还有老鼠拿钱和猫换食物。 #include #include using namespace std;struct time { int s; int e; bool operator < (const time &A) const { return e < A.e;... 阅读全文
posted @ 2015-02-27 15:52 StevenLuke 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 要判断重复值,a+b=n,判断a、n-a是否是素数#include#include#include#include using namespace std;int Is_Prime(int n){ int r,i; if(n>n&&n){ cont=0; for(int i=2;i<=n/2... 阅读全文
posted @ 2015-02-27 15:24 StevenLuke 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 深入理解按位异或运算符 参与运算的两个值,如果两个相应bit位相同,则结果为0,否则为1。 即: 0^0 = 0, 1^0 = 1, 0^1 = 1, 1^1 = 0 按位异或的3个特点: (1) 0^0=0,0^1=1 0异或... 阅读全文
posted @ 2015-02-27 14:58 StevenLuke 阅读(80) 评论(0) 推荐(0) 编辑