摘要:
#include using namespace std;char map[10][10];int n;int sum;int judge(int k) //判断该点能否放置大炮{ int x = k / n; int y = k % n; int i; for(i=y; i>=0; i--) //从该点往左找 { if(map[x][i] == 'X') { break; } if... 阅读全文
摘要:
#include #include using namespace std;int N, M, T, sx, sy, ex, ey; //sx,sy起点坐标 ex,ey终点坐标char map[6][6];const int dir[4][2] = { { 0, 1 }, { 1, 0 }, { 0, -1 }, { -1, 0 } };bool solved = false, ... 阅读全文
摘要:
/**********************************************************************************hdu 1045 Fire Net这题意思是给出一张图,图中'X'表示wall,'.'表示空地,可以放置blockhouse同一条直线上只能有一个blockhouse,除非有wall隔开,问在给出的图中最多能放置多少个blockho... 阅读全文
摘要:
#includeusing namespace std;#define max 10010int c1[max],c2[max]; //c1存结果,c2存临时处理数据//Y=(1+x+x^2+x^3+x^4…+x^n1*1)*(1+x^2+x^4+x^6…x^n2*2)*(1+x^5+x^10+…x^n3*5)int main(){ int num[3]; int val[] = {1, ... 阅读全文
摘要:
#include #include #include #include using namespace std;#define mark student#define que solvestruct student{ int solve; int time; int grade; int set;};int cmp(const void *a, const void *b ){ if((*(stu... 阅读全文
摘要:
#include #include /*合九法:如果把一个大数的各位数字相加得到一个和,再把这个和的各位数字相加又得一个和,再继续作数字和,直到最后的数字和是个位数为止,这最后的0-9中的一个数称为最初那个数的“数字根”。如39,先是3+9=12, 不是单数则再加为1+2=3.所以3为39的数根这个数字根等于原数除以9的余数。如39%9=3.成立注意如果是9的数根因为除以9的余数为0,要特殊考虑。... 阅读全文
摘要:
#include #include #include #include #include #include #include #include #include #include #define INF 1000000001 //最大值要合理否则会超内存的using namespace std;int f[11000];int val[1100];int weight[1100];int... 阅读全文
摘要:
#include #include #include using namespace std;int lowbit(int x) //make sure the set of the array 求最小幂2^k{ return x&(-x);}int sum(int end ,int all[]) //solve sum 求前n 项和{ int sum=0; while(end > ... 阅读全文
摘要:
#include #include #include #include using namespace std;struct data{ char str[10]; int r_num, r_set;};int main(){ //freopen("read.txt", "r", stdin); int n; while(~scanf("%d", &n) && n!=0) { data num[... 阅读全文
摘要:
#include #include #include #include #include #define MAX(a,b) a>b? a:busing namespace std;int in[30]={2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 10... 阅读全文