摘要: 1~n依次入栈,输入1~n之间的数(出栈顺序),顺序不限,判断输入的出栈顺序是否存在 样例输入: 5 1 2 3 4 5 5 5 4 1 2 3 6 6 5 4 3 2 1 样例输出: yes no yes STL栈的实现 阅读全文
posted @ 2016-08-09 12:40 晴雨天 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 我们以1000为例,为了保存结果,需要先分析1000!有多大。大约为4*10的2567次方,因此可以用一个3000个的元素的数组f保存。为了方便进位,我们让f[0]保存各位,f[1]保存十位。。。。。。在输出时要忽略前导0。4!=24,那么从f[2]~f[1000]都为0需要忽略输出。 阅读全文
posted @ 2016-08-07 11:45 晴雨天 阅读(176) 评论(0) 推荐(0) 编辑
摘要: Description 两个士兵在玩一个游戏,开始的时候第一个士兵选择一个数n,并把这个数交给第二个士兵,第二个士兵必须选择一个x满足x>1 且n能被x整除,然后将n变为n/x,然后把这个数交给第一个士兵,依次循环,当n等于1时,游戏结束,第二个士兵所得的分数为他执行的游戏轮数(选择x的次数)。 为 阅读全文
posted @ 2016-07-31 23:16 晴雨天 阅读(187) 评论(0) 推荐(0) 编辑
摘要: Description ACboy has N courses this term, and he plans to spend at most M days on study.Of course,the profit he will gain from different course depen 阅读全文
posted @ 2016-07-26 14:24 晴雨天 阅读(179) 评论(0) 推荐(0) 编辑
摘要: Problem Description Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , s 阅读全文
posted @ 2016-07-25 16:45 晴雨天 阅读(237) 评论(0) 推荐(0) 编辑
摘要: Description Problem Description Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good 阅读全文
posted @ 2016-07-23 23:53 晴雨天 阅读(187) 评论(0) 推荐(0) 编辑
摘要: POJ 3253 Fence Repair (优先队列) Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs 阅读全文
posted @ 2016-07-21 22:39 晴雨天 阅读(1408) 评论(0) 推荐(0) 编辑
摘要: Problem Description Who is Dylans?You can find his ID in UOJ and Codeforces. His another ID is s1451900 in BestCoder.And now today's problems are all 阅读全文
posted @ 2016-07-19 22:45 晴雨天 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int main() 8 { 9 __int64 n,k,i,j; 10 while(scanf("%I64d",&n)!=EOF) 11 { 12 k=sqrt(n);j=0; ... 阅读全文
posted @ 2016-07-18 22:55 晴雨天 阅读(143) 评论(0) 推荐(0) 编辑