【发布时间】:2010-12-15 03:57:41
【问题描述】:
我一定是脑子里放屁什么的,但我似乎找不到解决办法。
如果您有一个列表事实,例如:
%country(country, population, capital)
country(sweden, 8823, stockholm).
country(usa, 221000, washington).
country(france, 56000, paris).
country(denmark, 3400, copenhagen).
%city(city, country, population)
city(lund, sweden, 88).
city(new_york, usa, 5000).
city(paris, usa, 1).
city(copenhagen, denmark, 1200).
city(aarhus, denmark, 330).
city(odense, denmark, 120).
city(stockholm, sweden, 350).
city(washington, usa, 3400).
city(paris, france, 2000).
city(marseilles, france, 1000).
我想找到人口第二大的城市,在本例中是美国华盛顿,有 3400 人。你怎么能做到这一点?
谢谢。
【问题讨论】:
-
你会如何寻找最大的城市?