• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • YouClaw
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
緋時之鏡
博客园    首页    新随笔    联系   管理    订阅  订阅
2011年4月10日
HDU-2063 过山车 匈牙利算法
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2063#include <stdio.h>int graph[510][510], isVisit[510], match[510], m, n;int find(int a){ int i; for(i = 1; i <= n; i++){ if(graph[a][i] && !isVisit[i]){ isVisit[i] = 1; if((match[i] == -1) || find(match[i])){ match[i] = a; return 1; } } } 阅读全文
posted @ 2011-04-10 15:31 緋時之鏡 阅读(268) 评论(0) 推荐(0)
2011年4月6日
HDU-1754 I Hate It 线段树
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1754#include <stdio.h>int tree[1000000], left[1000000], right[1000000], ans;void build(int p, int l, int r){ tree[p] = 0; left[p] = l; right[p] = r; if(l != r){ build((p * 2), l, ((l + r) / 2)); build(((p * 2) + 1), (((l + r) / 2) + 1), r); } return;}v 阅读全文
posted @ 2011-04-06 19:11 緋時之鏡 阅读(121) 评论(0) 推荐(0)
HDU-1166 敌兵布阵 线段树
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1166#include <stdio.h>int tree[300000], left[300000], right[300000], sum;void build(int p, int l, int r){ tree[p] = 0; left[p] = l; right[p] = r; if(l != r){ build((p * 2), l, ((l + r) / 2)); build(((p * 2) + 1), (((l + r) / 2) + 1), r); } return;}void 阅读全文
posted @ 2011-04-06 18:29 緋時之鏡 阅读(116) 评论(0) 推荐(0)
数组模拟链表
摘要: #include <stdio.h>#define MAX_N 1000int n, next[MAX_N], data[MAX_N];void init(){ int i; n = 0; for(i = 0; i < MAX_N; i++){ next[i] = 0; } return;}void insert(int insertData, int nextData){ int pos = 0; n++; data[n] = insertData; while(next[pos] && (data[next[pos]] != nextData)){ pos 阅读全文
posted @ 2011-04-06 13:17 緋時之鏡 阅读(205) 评论(0) 推荐(0)
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3