摘要:
题目链接输入n个数(0或1),问是否能通过若干次交换相间的两个数字使得所有1都相邻。解法:当n为奇数时任意两个数字都能交换,当然是yes。当n为偶数时相间的两数字可以互相交换,这样会出现两组排列,然后把排列a插入排列b。并且b的相邻两个元素间只能插一个a的元素。要使所有的1相邻,显然a,b中1的个数... 阅读全文
posted @ 2015-03-15 22:06
Scale_the_heights
阅读(172)
评论(0)
推荐(0)
摘要:
题目链接求让城市1到其他城市在保证最短路的情况下求最小花费,最短路水题。#include #include #include #include using namespace std;const int INF=1e9;struct edge{ int u,v; int len,cost... 阅读全文
posted @ 2015-03-15 00:39
Scale_the_heights
阅读(176)
评论(0)
推荐(0)

浙公网安备 33010602011771号