2011年9月1日
摘要: 淘宝笔试题: 有N个蛋和M个篮子,把蛋放到M个篮子里,每个篮子都不能为空。另外,需要满足:任意一个小于N的正整数,都能由某几个篮子内蛋的数量相加的和得到。写出程序,使得输入一个(N,M),输出所有可能的分配情况 #include "StdAfx.h"#include <iostream>#include <math.h>using namespace std;#defin... 阅读全文
posted @ 2011-09-01 17:15 yangyh 阅读(544) 评论(0) 推荐(0)
摘要: #define MASK 0x80000000#define IS_A_SMALL(a , b) ((((a) - (b))&MASK) == MASK)#define MAX(a,b) (IS_A_SMALL(a,b)*(b) + IS_A_SMALL(b,a) *(a)+ ((a)==(b))*((a)+(b))/2)// ==的优先级大于& | ^ 阅读全文
posted @ 2011-09-01 10:46 yangyh 阅读(259) 评论(0) 推荐(0)