• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Eric.cpp
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理

随笔分类 -  最短路

 
2012哈工程ACM暑期集训图论专场(练习赛第7场)题解
摘要:1001~1004比较简单,就不给大家题解了,做不出的再好好想想。1005View Code #include <iostream>#include <stdio.h>using namespace std;int parent[10005];int find(int x){ return x==parent[x] ? x : parent[x]=find(parent[x]);}int main(){ int n,m,a,b; char q[2]; int k=0; while(cin >> n >> m){ printf("Case 阅读全文
posted @ 2012-08-20 11:53 Eric.cpp 阅读(490) 评论(0) 推荐(0)
hdu-4318(最短路)
摘要:很经典的最短路问题。只需修改一下松弛方程就可以。比赛的时候被北京某年Regional的一道题误导了,开始没敢做,后来发现被群A后才做的。。o(╯□╰)o松弛方程修改如下:int relax(int u,int v,double c){ if(dist[v] > dist[u]+(M-dist[u])*((double)c/100.0)){ dist[v] = dist[u]+(M-dist[u])*(c/100.0); return 1; } return 0;}附AC代码:View Code #include <iostream>#include... 阅读全文
posted @ 2012-07-27 16:34 Eric.cpp 阅读(274) 评论(0) 推荐(0)
hdu-4308(bfs)
摘要:多校第9题:巧妙的广搜,遇到第一个P的时候,将所有的其他P都压入队列,再搜下去就会接着P开始往下搜,搜到C结束。附代码:View Code #include <iostream>#include <string.h>#include <stdio.h>using namespace std;#define V 5010char map[V][V];bool vis[V][V];int dir[4][2]={{1,0},{0,1},{0,-1},{-1,0}};struct Node{ int x,y; long long step;}q[V];int r,c 阅读全文
posted @ 2012-07-26 12:00 Eric.cpp 阅读(253) 评论(0) 推荐(0)
2012 Multi-University Training Contest 1
摘要:仅仅做出了1009(hdu-4308),广搜,搜到第一个P的时候将左右P都入队列并标记,再继续搜下去,搜到C即得出结果。View Code #include <iostream>#include <string.h>#include <stdio.h>using namespace std;#define V 5010char map[V][V];bool vis[V][V];int dir[4][2]={{1,0},{0,1},{0,-1},{-1,0}};struct Node{ int x,y; long long step;}q[V];int r,c 阅读全文
posted @ 2012-07-19 22:17 Eric.cpp 阅读(203) 评论(0) 推荐(0)
2012黑龙江省赛J题-最小均值圈
摘要:有重边,有自环,卡精度.View Code /*Source CodeProblem: 1001Username: 2010201211Run Time: 304MSMemory: 1208KLanguage:C++JudgeStatus: AcceptedAuthor:MarkLiu*/#include <iostream>#include <algorithm>#include <cstdio>#include <stdio.h>#include <string.h>using namespace std;const int N 阅读全文
posted @ 2012-06-05 11:47 Eric.cpp 阅读(242) 评论(0) 推荐(0)
 

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3