我的ubuntu12.04,python是2.7的, 要安装PIL库nn当我用 sudo pip install pil安装时,错误提示:nnCould not find any downloads that satisfy the requirement pilnn Some externally hosted files were ignored (use --allow-external pil to allow).n n当用sudo apt-get install python-imaging可以安装成功,但是运行程序的时候有错误提示:nThe _imaging C module is not installednn请问这两种安装的方法有什么区别吗?请问如何可以使第一种方法安装成功?恳请各位大师指点,谢谢.
Problem DescriptionnThe nation of Graphia is at war. The neighboring nations have for long watched in jealousy as Graphia erected prosperous cities and connected them with a network of highways. Now they want a piece of the pie.nnGraphia consists of several cities, connected by highways. Graphian terrain is rough, so the only way to move between the cities is along the highways. Each city has a certain number of troops quartered there. Graphia's military command knows that it will require a certain number of troops, K , to defend any city. They can defend a city with the troops stationed there, supported by the troops in any other city which is directly connected with a highway, with no cities in between. Any troops further away than that simply cannot get there in time. They also know that their enemies will onlyattack one city at a time -- so the troops in a city can be used to defend that city, as well as any of its neighbors. However, if a city can't be defended, then the military command must assume that the troops quartered in that city will be captured, and cannot aid in the defense of Graphia. In the case below, suppose K = 10 . City C might seem well defended, but it will eventually fall.nnnnnGraphia's leadership wants to identify the Heart of their <em>country</em> -- the largest possible group of cities that can mutually defend each other, even if all of the other cities fall.nnMore formally, a city is defensible if it can draw a total of at least K troops from itself, and from cities directly adjacent to it. A set of cities is defensible if every city in it is defensible, using only troops from itself and adjacent cities in that set. The Heart of the <em>country</em> is the largest possible defensible set of cities - that is, no other defensible set of cities has more cities in it.n nnInputnThere will be several data sets. Each set begins with two integers, N and K , where N is the number of cities ( 3s.n nnOutputnFor each data set, print two integers on a single line: The number of cities in the heart of the <em>country</em>, and the number of troops in the heart of the <em>country</em>. Print a space between the integers. There should be no blank lines between outputs.n nnSample Inputn4 900n100 2 1 2n200 2 0 3n500 2 0 3n1000 2 1 2n4 900n100 3 1 2 3n200 3 0 3 2n500 3 1 3 0n1000 3 2 1 0n0 0n nnSample Outputn3 1700n4 1800n
As you know, in a Tree there is exactly one path between two nodes. A Forest consists of one or more Trees. Country F has N cities, some cities are connected by roads, and these cites form a Forest with at least two trees.nnThe king of <em>country</em> F is a man with special ideas. He wants to make any two trees in the forest isomorphic. We say that two trees are isomorphic if they have same structure. That is to say, if we ignore the indices of all the nodes, the two trees are the same.nnnFor example, in the picture shown above, the middle tree and the right tree are isomorphic, but the middle tree and the left tree are not isomorphic.nnBecause it is expensive to build roads, the King decides only to destroy edges. But if too many roads are destroyed, people in <em>country</em> F will be angry, so he can destroy at most ONE road.nnnNow, the King asks you whether it is possible to make any two trees isomorphic, if he destroys at most one road.nnInputnnThere are multiple cases (no more than 60). For each case, the first line is two integers N and M (2 < N, x != y), means there is a road between city x and city y. You may assume that there is at most one road between any two cities and the cities forms a forest with at least two trees.nnThe last case is followed by two zeros.nnOutputnnFor each case, if it is possible for the King to make any two trees isomorphic when destroying at most one road, output "Yes", otherwise output "No".nnSample Inputnn9 7n0 1n0 2n1 3n3 4n3 5n6 7n6 8n9 7n0 1n1 2n1 3n3 4n3 5n6 7n6 8n5 2n0 1n1 2n0 0nSample OutputnnYesnYesnNo