码迷,mamicode.com
首页 >  
搜索关键字:legal or not    ( 126个结果
HDU 3342 Legal or Not (图是否有环)
题意:给出n个人的师徒关系,如有 a是b的师傅,b是c的师傅,c是a的师傅,这样则不合法,输出NO,否则输出YES。思路:每段关系可以看成一条有向边,从师傅指向徒弟,那么徒弟的徒子徒孙都不可能再指向其师傅或自己,所以不可能构成环。两种方法 :1,用拓扑的方法,每次去掉一个入度为0的点,全部点都去掉就...
分类:其他好文   时间:2015-06-18 21:37:17    阅读次数:113
ChampOn Home Licensed Agreement
EnglishiOS LICENSED APPLICATION - END USER LICENSE AGREEMENTPLEASE READ CAREFULLY THE FOLLOWING LEGAL AGREEMENT (“Agreement”). THIS AGREEMENT CONSTITU...
分类:其他好文   时间:2015-05-25 16:20:04    阅读次数:91
MIT麻省理工学院公开课:计算机科学及编程导论 Python 笔记1-3
Lecture1:Goals of the course; what is computation; introduction to data types, operators, and variablesPython High VS. low General VS. targetted Interpreted VS. compileSyntax语法:what are legal express...
分类:编程语言   时间:2015-05-18 16:54:48    阅读次数:183
hdu 3342 Legal or Not
一道极其水的拓扑排序……但是我还是要把它发出来,原因很简单,连错12次……题意也很裸,前面的废话不用看,直接看输入输入n, m表示从0到n-1共n个人,有m组关系截下来m组,每组输入a, b表示a指向b,或者b指向a也行。输入n == 0时结束如果可以拓扑排序,输出"YES",否则输出"NO"。每组...
分类:其他好文   时间:2015-05-06 01:09:04    阅读次数:133
HDU3342 Legal or Not(拓扑排序)
Legal or Not Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5152    Accepted Submission(s): 2360 Problem Description ACM-DIY is a larg...
分类:编程语言   时间:2015-04-21 22:38:27    阅读次数:183
hdu 3342 Legal or Not
简单的拓扑排序。#include#include#include#include#includeusing namespace std;int rudu[105];vectorabc[105];int main(){ int n, m, i, x, y, j, k; while (~sc...
分类:其他好文   时间:2015-04-18 14:25:04    阅读次数:106
hdu 3342 Legal or Not
和5154一模一样,不想说什么 #include #include #include #define maxn 100+10 using namespace std; int n,m; int head[maxn]; vector >mapp; void topo() { queueroot; for(int i=0;i<n;i++) { if(!head[i]) root.push(...
分类:其他好文   时间:2015-04-14 19:44:11    阅读次数:90
Codeforces 327E Axis Walking 状压dp(水
题目链接:点击打开链接 题意: 给定n个数,随意排列。 给定k个违禁数b[]。 问:有多少个排列使得这个排列的 n项前缀和中不出现违禁数。 (formally,if it's a legal permutation, sum[i] != b[j] (1 sum[0] = 0; sum[i] = sum[i-1]+a[permutaion[i]]; ==java党表示被tle,心疼自己...
分类:其他好文   时间:2015-03-20 23:55:19    阅读次数:519
HDU 1258 确定比赛名次 &&HDU 3342 Legal or Not 【临接表+拓扑排序】
HDU 1258 链接:click here HDU 3342 链接:click here 题意: 确定比赛名次 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 14142    Accepted Submission(s)...
分类:编程语言   时间:2015-03-16 19:24:44    阅读次数:210
hdu 3342 Legal or Not
题意:判断有无环路; 思路:拓扑排序; 两种写法: 结构体+指针: #include #include #include using namespace std; int n,m; struct node{ int du; node *next; }q[50010]; int topo() { node *p; int *shu=new int[50010]...
分类:其他好文   时间:2015-03-14 17:03:52    阅读次数:142
126条   上一页 1 ... 7 8 9 10 11 ... 13 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!