链表模版
来源:互联网 发布:网络培训工程平台 编辑:程序博客网 时间:2024/05/18 22:43
简单的链表模版
#include<cstdio>#include<iostream>#include<cstring>using namespace std;struct edge{int u,v,c;int next;}e[10000];int cnt;int head[1000];void init(){cnt=0;memset(head,-1,sizeof(head));}void add(int u,int v,int c){e[cnt].u=u;e[cnt].v=v;e[cnt].c=c;e[cnt].next=head[u];head[u]=cnt++;}int main(){int n,m;while(cin>>n>>m){init();int u,v,c;for(int i=0;i<m;i++){cin>>u>>v>>c;if(u>v){int temp=u;u=v;v=temp;}add(u,v,c);}for(int i=0;i<n;i++){for(int j=head[i];j>=0;j=e[j].next)printf("u %d v %d c %d\n",e[j].u,e[j].v,e[j].c );}}return 0;}
- c++ 链表模版
- 静态链表模版
- 链表模版
- 简易栈模版(链表实现)
- 循环队列模版(链表实现)
- c++模版链表的实现
- c++模版链表的实现
- 邻接表模版c+
- 静态邻接表模版
- 模版—素数表
- 模版实现顺序表
- mysql建表模版
- 模版
- 模版
- 模版
- 模版
- 模版
- 模版
- SAP SPAM SAINT
- shell中文件处理及字符串处理
- 马上会跌,跌破一千
- OpenOfficesy跳过某些模块后打包不成功
- NSArray和NSMutableArray的用法
- 链表模版
- 在eclipse下编译和运行c#的代码!
- android 常用知识点
- 动态规划优化之使用Map记忆化搜索
- 关于c++中const和指针结合的使用
- zoj - 3631 - Watashi's BG(dfs)
- 编译 Hadoop-append 用于Hbase
- 2013金山西山居创意游戏程序挑战赛——复赛(1) 涂色游戏
- Visual C++ 字符编码设置