【回溯】装载问题
摘要:1 #include "stdio.h" 2 #include "stdlib.h" 3 int c1,c2,n; 4 int w[1000],s[1000],bs[1000]; 5 int mw=0; 6 void max(int c,int i,int cw) 7 { 8 if(i==...
阅读全文
Add two Numbers
摘要:Add Two NumbersYou are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes co...
阅读全文
Two Sum
摘要:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu...
阅读全文
【动态规划】循环赛日程表
摘要:1 #include 2 #include 3 int a[10000][10000]; 4 void huan(int row,int len) 5 { 6 int i,j; 7 for(i=0; i<len/2; i++) 8 { 9 for(j=0...
阅读全文
【递归】走迷宫
摘要:走迷宫时限:1000ms内存限制:10000K总时限:3000ms描述:判断是否能从迷宫的入口到达出口输入:先输入两个整数表示迷宫的行数m和列数n,再输入口和出口的坐标,最后分m行输入迷宫,其中1表示墙,0表示空格每个数字之间都有空格。输出:若能到达,则输出"Yes",否则输出"No",结果占一行。...
阅读全文
二分查找
摘要:1 #include 2 #include 3 4 5 int main() 6 { 7 int a[10000],n,m,i,j,k,low,high,mid,flag; 8 scanf("%d",&n); 9 for(i=0; ia[mid])46 ...
阅读全文
【递归】N位全排列
摘要:1 #include 2 #include 3 4 int n; 5 int a[10]; 6 7 void search(int m) 8 { 9 10 if(m==n){11 printfresult();12 }else13 {14 ...
阅读全文
【递归】归并排序
摘要:1 #include 2 #include 3 4 int a[10000],b[10000],n; 5 6 7 void Merge(int left,int mid,int right) 8 { 9 int l=left,m=mid,k=left;10 while(l...
阅读全文
【动态规划】最大子序列
摘要:1 #include 2 #include 3 4 int length; 5 int c[20][20]; 6 int b[20][20]; 7 char f[20],s[20]; 8 9 void l(int m,int n)10 {11 int i,j;12 for(...
阅读全文