随笔分类 - 算法积累
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 int main() 6 { 7 char a[1005],b[1005]; 8 while(cin>>a) 9 { 10 cin>>b; 11 list s1(a,a+strlen(a)); 12 ...
阅读全文
摘要:1 #include 2 #include 3 using namespace std; 4 int main() 5 { 6 set s; 7 int n; 8 while(cin>>n) 9 { 10 int k; 11 while(n--) 12 { 13 cin>>k; 14 s.inser...
阅读全文
摘要:题目描述 老鼠被猫抓去坐牢了,所在的这个监狱是一个N * M (N, M <= 200)的矩形,监狱中由一些墙,路,警卫组成 。 老鼠的朋友想要救出它,而任务是接近老鼠。我们假设拯救老鼠的任务是到达老鼠所在的位置,上,下,左,右的移动都需要花费1个单位的时间,杀死守卫也需要花费1个单位的时间,而我们
阅读全文
摘要:贪心,覆盖点问题 思路: 1、排序,按first从小到大排,如果first一样按照second从小到大排 2、first没有1以及second没有T的直接输出-1,结束 3、从头开始找能首尾连上并且每一片尽可能覆盖大的cow,计数。如果中间出现首尾不能连输出-1结束。
阅读全文
摘要:题目描述 Given a stack which can keep MM numbers at most. Push NN numbers in the order of 1, 2, 3, ..., NN and pop randomly. You are supposed to tell if a
阅读全文
摘要:题目描述 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条
阅读全文

浙公网安备 33010602011771号