一个acm试题,怎样判断是不是数据结尾
2007-07-26 09:50
429 查看
If a tree falls in the forest, and there's nobody there to hear, does it make a sound? This classic conundrum was coined by George Berkeley (1685-1753), the Bishop and influential Irish philosopher whose primary philosophical achievement is the advancement of what has come to be called subjective idealism. He wrote a number of works, of which the most widely-read are Treatise Concerning the Principles of Human Knowledge (1710) and Three Dialogues between Hylas and Philonous (1713) (Philonous, the "lover of the mind," representing Berkeley himself).
Input
A forest contains T trees numbered from 1 to T and P people numbered from 1 to P. Standard input consists of a line containing P and T followed by several lines, containing a pair of integers i and j, indicating that person i has heard tree j fall. People may have different opinions as to which trees, according to Berkeley, have made a sound.
Input contains multiple test cases. Subsequent test cases are separated with a single blank line.
Output
How many different opinions are represented in the input? Two people hold the same opinion only if they hear exactly the same set of trees. You may assume that P < 100 and T < 100.
Sample Input
3 4
1 2
3 3
1 3
2 2
3 2
2 4
Sample Output
2
请问我怎样才知道当输入2 4的时候代表数据输入完毕
Input
A forest contains T trees numbered from 1 to T and P people numbered from 1 to P. Standard input consists of a line containing P and T followed by several lines, containing a pair of integers i and j, indicating that person i has heard tree j fall. People may have different opinions as to which trees, according to Berkeley, have made a sound.
Input contains multiple test cases. Subsequent test cases are separated with a single blank line.
Output
How many different opinions are represented in the input? Two people hold the same opinion only if they hear exactly the same set of trees. You may assume that P < 100 and T < 100.
Sample Input
3 4
1 2
3 3
1 3
2 2
3 2
2 4
Sample Output
2
请问我怎样才知道当输入2 4的时候代表数据输入完毕
相关文章推荐
- 判断一个对象是不是JavaScript数组(怎样判断一个变量是数组)
- 怎样判断一个泛型的数据具体是什么类型
- 怎样判断一个整数是不是回文数?
- oracle里判断一个字段是不是数据或者字符串
- 怎样判断一个网站是不是模板建站
- 怎样从数学的角度判断一个数是不是另一个数的指数
- 怎样在数据绑定到DATAGRID之前,先判断其中一个字段是否为空?
- 怎样判断一个数是不是质数
- 面试题-怎样判断一个对象是不是function?
- 怎样知道一个数是不是2的N次方,怎样判断一个数是奇数还是偶数
- 怎样用SQL语句判断一个数据表中至少N项不为空???
- 怎样知道一个数字是不是2的乘方?怎样判断一个数是不是奇数? Java实现
- 软件开发者面试百问-----怎样知道一个数字是不是2的乘方?怎样判断一个数是不是奇数?
- 【笔试】超大文件里的数据去重排序;将log中MAC地址提取出来;取出数据库表T里第20行到29行的数据;如何判断一个二叉树B是不是二叉树A的子树?
- 判断给出的序列是不是一个二叉搜索树的后序遍历
- 怎样判断一个文件存在(vc)
- 判断一个二叉树是不是平衡的(算法)
- VB中用正则表达式判断一个字符串是不是一个URL地址
- 判断一个类是不是另一个类的子类
- 判断本地系统目录下是否存在XML文件,如果不存在就创建一个XMl文件,若存在就在里面执行添加数据