2013年10月6日
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4740 #include #include #define M 1005int n;int Dx,Dy,Ds,Gx,Gy,Gs;int Df[M][M],Gf[M][M];const int move[4][2] = {{0,1},{1,0},{0,-1},{-1,0}};int judEdge(int x, int y){ if(x = n || y = n) return 0; return 1;}void Dturn(){ Ds = (Ds + 1) % 4;}void Gtu... 阅读全文
posted @ 2013-10-06 17:20 lk1993 阅读(291) 评论(0) 推荐(0) 编辑
  2013年9月12日
摘要: 这题坑爹,说好的五百组呢?There are at most 500 target in the Makefile. !!!!!If You Know This,You Must Have NO GFhttp://acm.hdu.edu.cn/showproblem.php?pid=4724#pragma warning(disable : 4786)#include #include #include #include using namespace std;typedef string String;#define M 5050map Com;set haveFile;set fileLi 阅读全文
posted @ 2013-09-12 10:28 lk1993 阅读(282) 评论(0) 推荐(0) 编辑
  2013年8月16日
摘要: 选定 'b' 开头的单词,深搜到底,如遇 'm' 结尾,返回。#include #include #define M 1002char map[M][M];int flag[M],tot,re_flag;void dfs(int i){ char endCH = map[i][(int)strlen(map[i]) - 1]; if(endCH == 'm') { re_flag = 1; return ; } for(int j=0; j<tot; j++) { if(!flag[j] && endCH == ma... 阅读全文
posted @ 2013-08-16 17:17 lk1993 阅读(296) 评论(0) 推荐(0) 编辑
  2013年8月15日
摘要: #include #include #include using namespace std;#define M 1002struct node { int j,f; node(int _j,int _f) { j = _j; f = _f; } friend bool operator q;int main(int argc, char* argv[]){ #ifdef __MYLOCAL freopen("in.txt","r",stdin); #endif int m,n,Ji,Fi; double s; ... 阅读全文
posted @ 2013-08-15 09:57 lk1993 阅读(160) 评论(0) 推荐(0) 编辑
摘要: #include#includeusing namespace std;#define M 1002struct node{ int j,f;};struct node jf[M];bool cmp(const node &a,const node &b){ return 1.0 * a.j / a.f > 1.0 * b.j / b.f;}int main(){// freopen("in.txt","r",stdin); int m,n; double s; while(scanf("%d%d",&m 阅读全文
posted @ 2013-08-15 09:56 lk1993 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 1. a ^ b = b ^ a ;2. a ^ b ^ c = a ^ (b ^ c) = (a ^ b) ^ c ;3. d = a ^ b ^ c 可以推出 a = d ^ b ^ c ;4. a ^ b ^ a = b .#include #include #define M 1002int id[M];int main(){// freopen("in.txt","r",stdin); int n; while(scanf("%d",&n) != EOF) { for(int j=0; j 'Z') 阅读全文
posted @ 2013-08-15 09:33 lk1993 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 这题做起来有些烦躁,可能是题意没有理解清楚吧。题意:造出来的士兵第一天没有攻击力,但可以采样,且要消耗一天的生命,共 d 天生命。造一个士兵需要 k 天,k + 1 天时可以有攻击力,造到 k 天时相当于成活士兵的第一天。刚开始的士兵为第一天的士兵,没有攻击力,但可以采样。总共模拟 x 天。数据较大,采用 __int64。ps: 这题应该有数学公式,但难的推导,直接模拟了。#include #include #define M 102int n,d,k,a,x;__int64 live[M],grow[M],all;void add_day(){ __int64 A = 0; li... 阅读全文
posted @ 2013-08-15 09:27 lk1993 阅读(201) 评论(0) 推荐(0) 编辑
  2013年8月13日
摘要: 标准广搜限制转弯次数同广搜_限制转弯次数(HDU_1728)#include #include #include using namespace std;#define M 1002struct node { int x,y,turn; node(int _x,int _y,int _turn) { x = _x; y = _y; turn = _turn; }};int map[M][M],flag[M][M];int move[4][2] = {-1,0,0,1,1,0,0,-1};queue q;int n,m;int judge(int x,int... 阅读全文
posted @ 2013-08-13 17:06 lk1993 阅读(267) 评论(0) 推荐(0) 编辑
摘要: 广搜限制转弯次数直线搜索当前位置的四个方向,把途中没有访问的点 turn 值 +1 入队。 说明:如果直线到达终点,则返回 true;如果四个方向都没有到达,则一定会转向,则退出队列中 turn值 +1 的位置;首先判断当前 turn ,如果超限制,则一定不会再有位置可以到达终点(队列中的点都是不递减的);如果没有,继续直线搜索当前位置的四个方向。#include #include #include using namespace std;#define M 102struct node { int x,y,turn; node(int _x,int _y,int _turn) ... 阅读全文
posted @ 2013-08-13 17:00 lk1993 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 十六进制六十四位不能直接输出负数,要判断输出。#include #include int main(int argc, char* argv[]){ #ifdef __MYLOCAL freopen("in.txt","r",stdin); #endif __int64 A,B,C; while(scanf("%I64X%I64X",&A,&B) != EOF) { C = A + B; if(C < 0) { C = -C; printf("-"); } ... 阅读全文
posted @ 2013-08-13 13:41 lk1993 阅读(150) 评论(0) 推荐(0) 编辑