http://poj.org/problem? id=1741 Description Give a tree with n vertices,each edge has a length(positive integer less than 1001). Define dist(u,v)=The min distance between node u and v. Give an integer k,for every pair (u,v) of vertices is called va
a=[1,2,3,4] b=[5,6,7,8] c=[a,b] def test(c): for i in c: return i print(test(c)) 以上代码执行后打印出来的结果是 预期目标是打印出a,b中的所有数据,需要创建一个空数组,把循环的结果传入数组,然后再用一个函数for数组内的内容打印 a=[1,2,3,4] b=[5,6,7,8] c=[a,b] def test(c): list=[] #创建一个空数组 for i in c: list.append(i) #把循环C
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) 看到这个时间,我懵逼了... 果然,Java就是打表,都不能AC,因为Java的输入是流,需要的时间比C真的长好多.... Problem Description You just need to calculate the sum of the formula: 1^2+3^2+5^2+--+ n ^2. Input In each