上一页 1 ··· 5 6 7 8 9 10 下一页
摘要: 题意:求最出小环,输出路径#include #includeusing namespace std;#define N 110#define INF 0xffffffint map[N][N],n,m,dist[N][N],pre[N][N],path[N];/* run this program using the console pauser or add your own getch, system("pause") or input loop */void floyd(){ int i,j,k,ans=INF,num,p; for(i=0;idist[i][k]+d 阅读全文
posted @ 2013-07-31 11:04 Teemo的技术blog 阅读(64) 评论(0) 推荐(0)
摘要: #include #includeusing namespace std;#define N 110#define INF 0xffffffint map[N][N],n,m,dist[N][N];/* run this program using the console pauser or add your own getch, system("pause") or input loop */void floyd(){ int i,j,k,ans=INF; for(i=0;id) map[a-1][b-1]=map[b-1][a-1]=d; } floyd(); } re 阅读全文
posted @ 2013-07-31 10:08 Teemo的技术blog 阅读(107) 评论(0) 推荐(0)
摘要: 三个人整个下午都想不出这题后来看题解,竟然用匈牙利算法的最大独立集,我顿时晕了。题意:给竖着和横着的方块,除去重叠的,最多能留下几个方块#include #include using namespace std;#define N 1010struct Point{ int x,y; Point(){} Point(int a,int b){x=a;y=b;} bool operator==(const Point &a)const{ return x==a.x&&y==a.y; }}pn[N],pm[N];int link[N],n,m;bool ... 阅读全文
posted @ 2013-07-25 21:47 Teemo的技术blog 阅读(117) 评论(0) 推荐(0)
摘要: 又是被自己的方向搞混了题意:走出去和遇到之前走过的就输出。#include #include #includeusing namespace std;#define N 110int map[N][N],visit[N][N],n,m,flag;//n为x轴 m为y轴 int dir[][2]={{0,1},{1,0},{0,-1},{-1,0}};//e,s,w,nint setdire(char s){ switch(s){ case 'E':return 0; case 'S':return 1; case 'W':return 2; ca 阅读全文
posted @ 2013-07-24 22:01 Teemo的技术blog 阅读(107) 评论(0) 推荐(0)
摘要: 做的差点想吐,调来调去,编译器都犯毛病,wlgq,幸好1a。题意:给你机器人怎走的路线,碰撞就输出#include #include #include#include#define N 110using namespace std;struct Rob{ int x,y,dire;//dire 1为e,2为s,3为w,4为n}rob[N];int n,m,a,b,map[N][N];int setdire(char s){ switch(s){ case 'E':return 1; case 'S':return 2; case 'W':retu 阅读全文
posted @ 2013-07-24 18:09 Teemo的技术blog 阅读(99) 评论(0) 推荐(0)
摘要: 翻出一年多前的代码看,发现以前的代码风格很糟糕题意:给你n个点 m为圆的半径,问需要多少个圆能把全部点圈到#include #include #include using namespace std; struct ss{ double x,y; }a[1005]; int cmp(ss x,ss y) { if(x.x==y.x)return x.y>n>>m) { if(n==0&&m==0.0)break; k++; flag=1; sum=0; if(m>x>>y; ... 阅读全文
posted @ 2013-07-21 22:01 Teemo的技术blog 阅读(114) 评论(0) 推荐(0)
摘要: DevC++4.9.9.2中,按 F8 开始调试。提示信息为:工程没有调试信息,您想打开工程的调试选项并重新生成吗?选择是后,再按F8,仍旧是这个信息。什么原因呢?按照帮助,Frequently Asked Questions (FAQ)中提示How do i enable Debugging mode ?Go to Compiler Options and click on the Compiler sheet. In the Linker section, put projectes?to 'Generate debugging information'. Do a  阅读全文
posted @ 2013-07-20 16:16 Teemo的技术blog 阅读(3430) 评论(0) 推荐(0)
摘要: 一道简单但是题意蛋疼的题目题意:给你个n*n的图,开始在左上角,要求走到右下角有多种走法,图上的数表示走几步,只能向右或向下走。#include#includeusing namespace std;#define N 40char map[N][N];int n;__int64 dp[N][N];__int64 solve(int x,int y){ if(dp[x][y]) return dp[x][y]; if(x==n-1&&y==n-1) return 1; if(map[x][y]=='0') return 0; if(x+map[x][y]- 阅读全文
posted @ 2013-07-07 16:52 Teemo的技术blog 阅读(120) 评论(0) 推荐(0)
摘要: 翻出以前的代码看看题意:走迷宫,遇到敌人要花一分钟。#include#includeusing namespace std;char map[205][205];int N = 999999999;int dir[4][2]={{0,1},{1,0},{-1,0},{0,-1}};int n,m;struct node{ int x; int y; int step; friend bool operatorb.step; }}begin,end;int bfs(){ priority_queueq; q.push(begin); node temp,t; int i; while(... 阅读全文
posted @ 2013-07-07 11:41 Teemo的技术blog 阅读(130) 评论(0) 推荐(0)
摘要: 做这类型的搜索比较少,看懂题意花了半天题意:给你个n*n的图,老鼠一次最远走k步,老鼠起初在(0,0),每次偷吃的东西必须比之前偷吃的要大。#include#includeusing namespace std;#define N 110int map[N][N],dp[N][N];int n,k;int dir[][2]={{1,0},{0,1},{-1,0},{0,-1}};int solve(int x,int y){ int i,j,max=0,sum,tx,ty; if(dp[x][y]) return dp[x][y]; for(i=0;i=0&&t... 阅读全文
posted @ 2013-07-06 21:04 Teemo的技术blog 阅读(94) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 下一页