http://acm.hdu.edu.cn/showproblem.php?pid=1285

 #include <stdio.h>
#include <string.h>
const int N=;
int p[N][N],in[N];
int n,m;
void toposort()
{
for (int i = ; i <= n; i++)
{
for (int j = ; j <= n; j++)
{
if(in[j]==)
{
if(i==)
printf("%d",j);
else
printf(" %d",j);
in[j]--;
for (int k = ; k <= n; k++)
{
if(p[j][k]==)
in[k]--;
}
break;
} }
}
}
int main()
{
while(~scanf("%d%d",&n,&m))
{
memset(p,,sizeof(p));
memset(in,,sizeof(in));
int p1,p2;
while(m--)
{
scanf("%d%d",&p1,&p2);
if(!p[p1][p2])
{
p[p1][p2] = ;
in[p2]++;
}
}
toposort();
puts("");
}
return ;
}

确定比赛名次(toposort)的更多相关文章

  1. HDU 1285 拓普排序 基本模板例题 确定比赛名次

    确定比赛名次 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Subm ...

  2. hdu1285 确定比赛名次(拓扑排序)

    确定比赛名次 Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submis ...

  3. hdoj 1285 确定比赛名次 【拓扑排序】

    确定比赛名次 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Sub ...

  4. HDU 1285:确定比赛名次(拓扑排序)

    确定比赛名次 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Subm ...

  5. hdu_1285_确定比赛名次_201312081335

    确定比赛名次 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Sub ...

  6. hduoj 1285 确定比赛名次

    http://acm.hdu.edu.cn/showproblem.php?pid=1285 确定比赛名次 Time Limit: 2000/1000 MS (Java/Others) Memory ...

  7. HDU 1285 确定比赛名次(简单拓扑排序)

    题目链接: 传送门 确定比赛名次 Time Limit: 1000MS     Memory Limit: 65536K Description 有N个比赛队(1 Input 输入有若干组,每组中的第 ...

  8. ACM: HDU 1285 确定比赛名次 - 拓扑排序

     HDU 1285 确定比赛名次 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u De ...

  9. HDU 1285 确定比赛名次

    传送门 确定比赛名次 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

随机推荐

  1. DBDA

    <?php class DBDA{ public $host = "localhost"; //服务器地址 public $uid = "root"; / ...

  2. 洛谷P1107 & BZOJ1270 [BJWC2008]雷涛的小猫

    一道DP. 给你一个矩阵里面有很多数,你需要从上往下找到一种跳跃方法使得经过的点的价值之和最大. 具体题面见链接 洛谷P1107 BZOJ1270 很明显是一个二维的DP. #include<b ...

  3. 模拟--P1427 小鱼的数字游戏

    题目描述 小鱼最近被要求参加一个数字游戏,要求它把看到的一串数字(长度不一定,以0结束,最多不超过100个,数字不超过2^32-1),记住了然后反着念出来(表示结束的数字0就不要念出来了).这对小鱼的 ...

  4. 【模板】大数乘法(51nod 1027)

    #include<cstdio> #include<cstring> #include<algorithm> #define LL long long #defin ...

  5. Spring核心技术(五)——Spring中Bean的作用域

    前文概述了Spring的容器,Bean,以及依赖的一些信息,本文将描述一下Bean的作用域 Bean的作用域 当开发者定义Bean的时候,同时也会定义了该如何创建Bean实例.这些具体创建的过程是很重 ...

  6. Sublime text如何设置快捷键让编写的HTML文件在浏览器预览?

      STEP 1 Tools->Build System->New Build System STEP 2<img src="https://pic3.zhimg.com/ ...

  7. spring boot & JsonParser

    spring boot https://stackoverflow.com/questions/29313687/trying-to-use-spring-boot-rest-to-read-json ...

  8. java多线程编程核心技术(二)--对象及变量的并发访问

    1.方法内部的私有变量是线程安全的,实例变量是线程不安全的. 2.A线程先持有object对象的lock锁,B线程可以以异步的方式调用object对象中的非synchronized类型的方法. 3.A ...

  9. dubbo 学习1

    1.高性能优秀的服务框架,应用可通过高性能的RPC实现服务的输出和输入功能,可以和spring框架无缝集成. 2.主要核心部件 a.remoting 网络通信框架 实现了sync-over-asnc ...

  10. HTML表单数据转JSON

    问题描述 后端使用如下方式接收前端传入参数: @PostMapping(value = "/test", produces = MediaType.APPLICATION_JSON ...