会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
2014acm
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
20
21
22
23
24
25
26
27
28
···
31
下一页
2014年8月4日
hdu 1016
摘要: #include using namespace std;int a[30],n,used[40];int is_prime(int x){ for(int i=2;i>n) { memset(used,0,sizeof(used)) ; a[1]=1; used[1]...
阅读全文
posted @ 2014-08-04 10:57 2014acm
阅读(124)
评论(0)
推荐(0)
2014年8月3日
zju 2744 回文字符 hdu 1544
摘要: #include#includeusing namespace std;int main(){ string s; while(cin>>s) { int i,begin,end,total = s.size(),l = s.size(); for(i ...
阅读全文
posted @ 2014-08-03 21:27 2014acm
阅读(140)
评论(0)
推荐(0)
广度优先(BFS) ------- 模板1:-----模板2:--------模板3:
摘要: //使用数组queue[ ]存放结点队列void BFS( ) { head=0; tail=1; queue[head]=首结点的值; while (head<tail) //队列不空 { temp=tail; for (k=head; k<=ta...
阅读全文
posted @ 2014-08-03 21:14 2014acm
阅读(256)
评论(0)
推荐(0)
搜索------深度优先DFS-----模板2:例1 例2 例3 例4
摘要: void DFS(int k) //处理第k步{ for (int i=1; iusing namespace std;int n,m, a[10];void DFS(int k){ for (int i=1; i>m>>n; DFS(0); return 0; ...
阅读全文
posted @ 2014-08-03 20:08 2014acm
阅读(178)
评论(0)
推荐(0)
memset
摘要: #include #include int a[10];using namespace std;int main(){ memset(a,-1,sizeof(a)); for(int i=0;i#include int a[10];using namespace std;int main(){me...
阅读全文
posted @ 2014-08-03 19:24 2014acm
阅读(205)
评论(0)
推荐(0)
if(!a)
摘要: f() ……; 是逻辑判断语句,如果括号内逻辑值为真,则继续执行下一条语句,否则不执行 计算机默认以“0”代表逻辑假,以“非0值”代表逻辑真上述程序的意思就是不断从键盘向a赋值,直到赋给a的值为一个非0数 若a非0,则逻辑值为真,“!”表示取反,!a的逻辑值就为假,不执行下一条语句;从逻辑值的角度考...
阅读全文
posted @ 2014-08-03 18:56 2014acm
阅读(1342)
评论(0)
推荐(0)
bailian 2698
摘要: #include#include#includeusing namespace std;int a[100],flag=1,b[10][10];int f(int k,int j){ for(int i=0;i#include#includeusing namespace std;int a[100...
阅读全文
posted @ 2014-08-03 18:05 2014acm
阅读(109)
评论(0)
推荐(0)
皇后问题
摘要: 递归回溯代码#include using namespace std;int n,m, a[10];bool bz[3][10];void DFS(int k){ int i;if (k==n) { for ( i=0; i>n; DFS(0);return 0;}V...
阅读全文
posted @ 2014-08-03 16:38 2014acm
阅读(158)
评论(0)
推荐(0)
搜索------深度优先DFS-----模板1:例1 例2 例3 例4
摘要: 深度优先(DFS)模板1:void DFS(int k) //处理第k步{ if (k==n) //已经处理到第n步,到达目的状态 输出结果 else//处理第k步 for (int i=1; iusing namespace std;int n,m, a[10];void DFS(int k)...
阅读全文
posted @ 2014-08-03 14:42 2014acm
阅读(285)
评论(0)
推荐(1)
bailian 2754八皇后
摘要: Description会下国际象棋的人都很清楚:皇后可以在横、竖、斜线上不限步数地吃掉其他棋子。如何将8个皇后放在棋盘上(有8 * 8个方格),使它们谁也不能被吃掉!这就是著名的八皇后问题。对于某个满足要求的8皇后的摆放方法,定义一个皇后串a与之对应,即a=b1b2...b8,其中bi为相应摆法中第...
阅读全文
posted @ 2014-08-03 13:02 2014acm
阅读(154)
评论(0)
推荐(0)
上一页
1
···
20
21
22
23
24
25
26
27
28
···
31
下一页
公告