随笔分类 - 思维---------------
摘要:Given a sequence with n elements, if the last element is also adjacent to the first element of the sequence, the sequence is called “circular sequence
阅读全文
摘要:题目: http://acm.hdu.edu.cn/showproblem.php?pid=5573 一棵二叉树,根结点值为1,左子结点为2i,右子结点为2i+1, 给出n和k,求在二叉树上从根向下共走k步(层),每步可以为当前结点权值取正号或者负号,求一种使最终取值和为n的可行方案(题目保证了k≤
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6667 思路:求个sum总和,另外再设个变量s=sum; for循环遍历过去 第i个的时候 他可以喝h=min(a【i】,sum-b【i】)杯奶茶 , 每次用s减去喝掉的 当s<0的时候代表没有足够的可以
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2491 贪心 找出每段的中点 因为这是牧师在场的所有可能时间段里 必然要经过的时间点 然后按这个排序 #include<bits/stdc++.h> using namespace std; struct
阅读全文