- 博客(6)
- 收藏
- 关注
原创 HDU1166 敌兵布阵(树状数组)
/* 树状数组太屌了,看了一天才模模糊糊看懂了这个题解然后自己敲了一遍,算是记住这个模板了 附上原题解网址: */#include #include #include using namespace std; int n,a[50000+5]; char str[10]; int lowbit(int i) //此处琢磨了许久,必须画图才能理解 { return i&(-i);
2015-07-29 10:56:40 618
原创 HDU 3501 Calculation 2 (欧拉函数)
C - Calculation 2Time Limit:1000MS Memory Limit:32768KB HDU 3501 Description Given a positive integer N, your task is to calculate the sum of
2015-07-29 10:51:58 380
原创 Tyvj P1082 找朋友
一开始想到的是直接排序,结果超时了,代码如下: #include #include #include #include #include #include #include using namespace std; const int maxn=10000+10; int n,shu[maxn]; char ren[maxn][50],s[50]; int main() {
2015-07-24 13:06:44 628
原创 POJ 2488 A Knight's Journey
题目连接:POJ 2488 /*这题属于最基础的搜索题,在平时的联系中遇到过很多次, 然而每次都放弃了,这次终于耐心的把它敲出来了, 看上去好懂,其实敲起来并不容易,卡了好多次才A掉 AC代码如下:*/ #include #include #include #include using namespace std; const int maxn=30; int p,
2015-07-22 10:17:16 308
原创 POJ 3620 Avoid The Lakes
//很水的dfs #include #include #include #include using namespace std; const int maxn=100+10; int mx[maxn][maxn],m,n,k,cnt; int dir[4][2]= {{-1,0},{0,-1},{1,0},{0,1}}; //四个方向 int dfs(int
2015-07-20 23:11:37 462
原创 HDU 2553 N皇后问题(递归搜索)
/* ……N皇后的摆放问题…… 一开始没有打表,所以一直TLE,之后参考了别人的代码才反应过来可以打表, 只要掌握了递归搜索再加上皇后摆放的控制条件就ok了。 下面附上AC代码: */ #include #include #include using namespace std; int temp,p,q[11]; void slove(int n
2015-07-20 18:07:35 539
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人