#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#define N 10000
using namespace std;
struct EDGE
{
int to;//终点
int cost;//边的权值
};
vector<EDGE>G[N];//G[i]中i表示出发点
int m,n;
int temp1;//出发点
int main()
{
scanf("%d%d",&n,&m);
while(m--)
{
EDGE e;
scanf("%d%d%d",&temp1,&e.to,&e.cost);//输入出发点,终点,边的权值
G[temp1].push_back(e);//将数据压入动态数组,表示在这个出发点下引出的边
//相当于二维动态数组
}
for (int i=; i<=n; i++) //按照出发点的顺序遍历
{
for(int j=; j<G[i].size(); j++) //遍历出发点所引出的边
{
EDGE e=G[i][j];//1以二维数组形式输出
printf("from %d to %d,the cost is %d\n",i,e.to,e.cost);
}
}
return ;
}

最新文章

  1. 数据分析:.Net程序员该如何选择?
  2. Connect to Database Using Custom params链接数据库配置参数说明
  3. awk用法总结笔记
  4. poj 2378(树形dp)
  5. 如何从官网下载springframework和document
  6. Apache与Tomcat整合
  7. Android开发之实用小知识点汇总-1
  8. Codeforces Round #322 (Div. 2) D. Three Logos 暴力
  9. 通过IP控制登录系统
  10. DS-5/RVDS4.0变量初始化错误
  11. [Android]SDK安装
  12. ASP.NET MVC 项目直接预览PDF文件
  13. Ubuntu下Java开发环境搭建(eclipse)
  14. android 图片内存管理
  15. Java字节码里的invoke操作&amp;&amp;编译时的静态绑定与动态绑定
  16. Spring MVC 注解 @RequestParam解析
  17. swoole web服务
  18. win7英文版
  19. 吴裕雄 17-MySQL 排序
  20. Kubernetes 存储系统 Storage 介绍

热门文章

  1. SmartSql 动态仓储
  2. java和c++中的DES\3DES\Base64
  3. 【requirejs】JS模块化工具requirejs教程
  4. win7下VS2010编译python3
  5. hdu4261 Estimation[暴力dp+对顶堆]
  6. js前台调用lodop打印
  7. Apache Kafka 0.9消费者客户端
  8. 【JS】手机屏幕旋转判断
  9. Msys2+mingw-w64 编译VS2013使用的ffmpeg静态库注意事项
  10. python 发红包