NP70. 首都
描述
输入描述
无输出描述
Python 解法, 执行用时: 10ms, 内存消耗: 2832KB, 提交时间: 2022-06-27
cities_dict = {'Beijing':{'Capital': 'China'},'Moscow':{'Capital': 'Russia'},'Paris':{'Capital': 'France'}} keys=sorted(cities_dict) for key in keys: aaa = cities_dict[key] print '{} is the capital of {}!'.format(key,aaa['Capital'])
Python 解法, 执行用时: 10ms, 内存消耗: 2836KB, 提交时间: 2022-06-10
a = { "Beijing": {"Capital": "China"}, "Moscow": {"Capital": "Russia"}, "Paris": {"Capital": "France"}, } for b in sorted(a.keys()): c = a[b]["Capital"]; print("{} is the capital of {}!".format(b, c));
Python 解法, 执行用时: 10ms, 内存消耗: 2840KB, 提交时间: 2022-07-14
cities_dict = {'Beijing':{'Capital': 'China'},'Moscow':{'Capital': 'Russia'},'Paris':{'Capital': 'France'}} for key in sorted(cities_dict): aaa = cities_dict[key] print('{} is the capital of {}!'.format(key,aaa['Capital']))
Python 解法, 执行用时: 10ms, 内存消耗: 2840KB, 提交时间: 2022-07-08
cities_dict = {'Beijing':{'Capital':"China"},'Moscow':{'Capital':'Russia'},'Paris':{'Capital':'France'}} for i in sorted(cities_dict): for j in cities_dict[i]: print("{} is the capital of {}!".format(i, cities_dict[i][j]))
Python 解法, 执行用时: 10ms, 内存消耗: 2844KB, 提交时间: 2022-06-23
cities_dict = {'Beijing': {'capital': 'China'},'Moscow': {'capital': 'Russia'},'Paris': {'capital': 'France'}} for i in sorted(cities_dict): print('%s is the capital of %s!'%(i,cities_dict[i]['capital']))