- 博客(9)
- 收藏
- 关注
原创 合并两个已排序的线性表——顺序表
写一个算法合并两个已排序的线性表。(用两种方法:数组表示的线性表(顺序表)和指针表示的线性表(链表)) 要求:1、定义线性表节点的结构,并定义节点的型和位置的型。 2、定义线性表的基本操作 3、在1,2的基础上,完成本题。 4、在main函数中进行测试:先构建两个有序的线性表,然后合并这两个线性表。#include <st...
2018-05-30 10:45:59 7352 4
原创 Red and Black
很简单,注意w,h的含义和二维字符数组输入#include <stdio.h>#include <string.h>char map[25][25];int visted[25][25];int w,h,cnt;int dir[4][2]={{0,1},{1,0},{-1,0},{0,-1}};void dfs(int x,int y){ if(x>=...
2018-05-23 21:14:25 215
原创 Oil Deposits-dfs
很简单,输入的时候注意下。#include <stdio.h>char map[110][110];int m,n,cnt;int dir[8][2]={{0,1},{0,-1},{1,0},{-1,0},{1,1},{-1,-1},{-1,1},{1,-1}};void dfs(int x,int y){ if(x>=m||y>=n) return; ...
2018-05-23 14:24:41 200
原创 素数环
很简单,注意回溯的终止条件。#include <stdio.h>#include <string.h>using namespace std;#define N1 40#define N2 25int Prime[N1],visted[N1],num[N2],vis[N2];int n;void prime(){ int i,j; Prime[2]=1;...
2018-05-21 09:41:36 207
原创 排列-1
比较简单,主要是next_permutation()函数的适用,还有就是输出格式的控制。#include <stdio.h>#include <algorithm>using namespace std;int num[4];int main(){ int flag=-2; while(~scanf("%d %d %d %d",&num[0],&...
2018-05-20 11:01:27 163
原创 N皇后问题-1
注意打表,不然超时!!!#include <stdio.h>#include <cmath>using namespace std;const int N=12;int map[N],cnt;bool check(int x,int y){ for(int i=1;i<x;i++){ if(map[i]==y||abs(x-i)==abs...
2018-05-20 10:33:38 3439
转载 动态规划-FATE
#include <stdio.h>using namespace std;#define min(x,y) (x<y)?x:y#define INF 0x7fffffffint a[110];int b[110];int dp[110][110];int main(){ int n,m,k,s,i,j,a,b,l,ans; while(~scanf("%d ...
2018-05-15 20:40:51 271
原创 动态规划-最大报销额
#include <stdio.h>#include <string.h>#include <iostream>using namespace std;#define max(x,y) (x>y)?x:yconst int AA=1000*100*35;int dp[AA];int NUM[35];int main(){ double ...
2018-05-15 18:20:46 612
转载 江苏省程序设计大赛-A-Easy h-index
A. Easy h-indexThe h-index of an author is the largest h where he has at least h papers with citations not less than h.Bobo has published many papers. Given a0, a1, a2, . . . , an which means Bobo h...
2018-05-15 08:51:15 1842
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人