LightOJ - 1003 Drunk】的更多相关文章

题目链接:http://lightoj.com/volume_showproblem.php?problem=1003 题意是有m个关系格式是a b:表示想要和b必须喝a,问一个人是否喝醉就看一个人是否能把所有种类的饮料喝完,能输出Yes,不能输出No: 其实就是有向图判断是否存在环,可以用拓扑排序来求 拓扑排序:每次找到一个入度为0的点加入队列,删除与之相连的边,循环操作,得到的序列就是拓扑序(前面的必须出现在后面的前面): #include<stdio.h> #include<str…
One of my friends is always drunk. So, sometimes I get a bit confused whether he is drunk or not. So, one day I was talking to him, about his drinks! He began to describe his way of drinking. So, let me share his ideas a bit. I am expressing in my wo…
One of my friends is always drunk. So, sometimes I get a bit confused whether he is drunk or not. So, one day I was talking to him, about his drinks! He began to describe his way of drinking. So, let me share his ideas a bit. I am expressing in my wo…
1003 - Drunk PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB One of my friends is always drunk. So, sometimes I get a bit confused whether he is drunk or not. So, one day I was talking to him, about his drinks! He began to…
有向图拓扑排序,判段是否存在. #include<map> #include<cstdio> #include<string> #include<cstring> #include<iostream> #include<algorithm> using namespace std; const int MAXN = 20010; struct Edge{ int to, next; }; Edge edge[MAXN >>…
提高自己的实力, 也为了证明, 开始板刷lightoj,每天题量>=1: 题目的类型会在这边说明,具体见分页博客: SUM=54; 1000 Greetings from LightOJ [简单A+B] 1001 Opposite Task  [简单题] 1002 Country Roads[搜索题] 1003 Drunk[判环] 1004 Monkey Banana Problem [基础DP] 1006 Hex-a-bonacci[记忆化搜索] 1008 Fibsieve`s Fantabu…
1381 - Scientific Experiment Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://www.lightoj.com/volume_showproblem.php?problem=1381 Description John wants to be a scientist. A first step of becoming a scientist is to perform experiment. John has de…
http://lightoj.com/volume_showproblem.php?problem=1422 做的第一道区间DP的题目,试水. 参考解题报告: http://www.cnblogs.com/ziyi--caolu/p/3236035.html http://blog.csdn.net/hcbbt/article/details/15478095 dp[i][j]为第i天到第j天要穿的最少衣服,考虑第i天,如果后面的[i+1, j]天的衣服不要管,那么dp[i][j] = dp[i…
Bestcoder#5 1003 Poor RukawTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 24    Accepted Submission(s): 11 Problem Description Last time, Hanamichi lost the basketball battle between him and Ru…
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little beaver is a beginner programmer, so informatics is his favorite subject. Soon his info…