- 博客(8)
- 收藏
- 关注
转载 填格子
#include #include #include #include #include using namespace std; int flag[3][4]; ///判断每个位置是否可以放数 bool vis[10]; int a[3][4]; ///每个位置进行放数 int sum = 0; int s[8][2] = {{
2017-03-25 11:28:23 558
原创 Jam的计数法
#include #include #include #include #include using namespace std; int s, t, w; vectora; bool next(int end,int len){ char last='a'+end-1;//序列中的最后一个 // char vlast=a.back();//vector中最后一个 // cout<<last;
2016-04-26 20:09:13 887
原创 宝岛探险
dfs问题,宝岛探险,求出所在岛屿的面积 #include using namespace std; const int maxn=200; int next[4][2]={{0,1},{1,0},{0,-1},{-1,0}};//右,下,左,上 int map[maxn][maxn];//宝岛地图 int flag[maxn][maxn]; //标记 int sx,sy;//开始坐标 int
2016-04-25 13:45:50 718
原创 皇后问题
//一个变化问题,要输出指定的皇后序列 //注释里的那段代码效率比较低 //去掉m变量就是n皇后问题 #include using namespace std; int n=8,m; int c[10]; int vis[10][100]; void dfs(int cur) { if(cur==n && (m--==1) ) { for(int i=0;i<n;i++) cout<<c
2016-04-20 13:20:17 345
原创 sprintf
#include //自守数 #include #include using namespace std; int tot;//0 1都是 char s1[2020]; char s2[4000000]; int f(int n) { if(n==0) return 1; int s=n*n; sprintf(s1,"%d",n);//用sprintf(s1,"%d",n);把int
2016-04-20 13:17:09 354
原创 UVA11292
/* 从算法竞赛入门经典训练指南上看到的题目,大概意思是有一条n个头的龙,m个勇士,每个勇士能力为x,雇佣价格也为x,每个勇士能砍掉不龙一个直径不超过x的头,如何雇佣是雇佣价格最少(贪心) 注意:每个勇士只能砍一个头且不能被雇佣两次 */ #include #include #include #include #include using namespace std; const int max
2016-04-14 12:21:13 553
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人