- 博客(14)
- 收藏
- 关注
原创 【TLE剪枝】UVa208救火车
看完大神http://blog.csdn.net/shuangde800/article/details/7750427 的博客才知道TLE的原因:从1(firestation)出发的路,并不一定能到达火灾处!应该从1出发,只走能通向火灾处的路。#include#includeint tlroutes;int fire;int gra[25][25];bool connect
2017-05-16 02:37:20 246
原创 UVa140宽带
#include#includeint gra[30][30];int node[30];int numnd;int ndpos[30];int order[30];int minwid;int ans[30];char input[300];void dfs(int cur,int max){ if(cur == numnd) { if(max < minwid)
2017-05-15 23:01:33 237
原创 UVa193图染色
#include#includeint m,n,k;int graph[110][110];int node[110]; //0 for white, 1 for blackint maxblack;int ans[110];//try to 'blacken' all nodes from 0 to n-1void dfs(int cur, int black){ if(cu
2017-05-15 20:30:15 164
原创 UVa10001伊旬园
就是题目特别难懂#include#includeint left[8] = {0,0,0,0,1,1,1,1};int cell[8] = {0,0,1,1,0,0,1,1};int right[8] = {0,1,0,1,0,1,0,1};int newc[8];int autom;int len;char cnum[50];int target[50];int ans[
2017-05-15 17:09:36 264
原创 UVa苏丹的继承者
#include#includeint graph[8][8];int col[8];int tl;int biggest;void dfs(int row){ if(row == 8) { int sum = 0; for(int i=0; i < row; ++i) { sum += graph[i][col[i]]; } if(sum > bigg
2017-05-15 03:08:49 320
原创 UVa10012箱子得有多大
看了别人的思路才知道特殊情况#include#include#includedouble radius[10];bool used[10];double centerpos[10]; //the position of circle's centerdouble radpos[10]; //radpos[i] = the radius of the circle hereint
2017-05-15 02:28:52 187
原创 win7 update
听到比特币勒索后,我也想跟风给windows7打补丁,结果。。。真是一波三折1、首先,windows update一直检查更新,解决方法(知乎 https://www.zhihu.com/question/35989879/answer/128232841):http://answers.microsoft.com/en-us/windows/forum/windows_7-upd
2017-05-14 02:32:47 1267 1
原创 10344UVA算23点
这个方法0.33(一遍全排列一遍求“23”)比上次那个0.15(用next_permutation生成全排序,在递归求“23”)慢一点#include#includeint arr[5];bool used[5];bool sum23(int cur,int sum){ if(cur == 5) { if(sum == 23) return true; else r
2017-05-08 21:27:27 217
原创 求非空子集(定序)
#include#includeint n;int a[30];void notempty_subset(int cur){ int start = cur?a[cur-1]+1 : 0; for(int i=start; i < n; ++i) { a[cur] = i; for(int j = 0; j <= cur; ++j) { printf("%d ",
2017-05-08 20:49:26 449 1
原创 301UVA地铁运输
注意:人数限制是指从站到站的人数,不是站台上的人数#include#includeint cpct,numsta,numord;int maxmoney;int sta[10];int start[25];int end[25];int psg[25];void dfs(int order, int money){ if(money > maxmoney) { max
2017-05-08 18:42:25 180
原创 539UVA卡坦岛
还不知道对不对。。。因为uva的judge queue塞车了#include#includeint n,m;int gra[30][30];int maxlen;void dfs(int u,int len){ if(len > maxlen) { maxlen = len; } for(int v = 0; v < n; ++v) { if(gra[u]
2017-05-08 17:01:03 203
原创 639UVa棋盘放车
#include#includeint graph[6][6];int num;int maxnum;bool ok(int cur){ int x,y; x = cur/num+1; y = cur%num+1; while(graph[x][y]!=-1) { if(graph[x][y] == 1) return false; --x; } x =
2017-05-08 14:42:49 295
转载 {递归}埃及分数
按刘汝佳书上解法做的(注意递归什么时候结束)#include#includeint maxd;int ans[100];int temp[100];int smallestdeno(int a,int b){ int res = b/a; return res*a >= b?res:res+1;}int gcd(int a,int b){ return b==0
2017-05-07 18:22:22 301
转载 {递归}实现的next_permutation
#include#includechar s[51];char now[51];int sn;int cnt[30];bool dfs(int cur,bool origin){ if(cur == sn) { now[cur] = '\0'; if(origin) return false; else return true; //find the next on
2017-05-07 16:23:10 189
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人