06 2011 档案

摘要:放苹果 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 17562 Accepted: 11076 Description 把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。 Input 第一行是测试数据的数目t(0 <= t <= 20)。以下每行均包含二个整数M和N,以空格分开。1<=M,N<=10。 Output 对输入的每组数据M和N,用一行输出相应的K。 Sample Input17 3Sample Outp 阅读全文
posted @ 2011-06-16 15:36 JustDoIt0 阅读(193) 评论(0) 推荐(0)
摘要:最近编程时出现了以前偶尔出现的栈溢出问题,于是认真查了一下资料,以便加深对程序内部运行的了解,以下是收集的资料。如果定义数组变量太大,将会出现栈溢出。因为定义的变量存储在栈中,而编译器分配的栈内存很小。所以改为:使用new 或者malloc 分配内存。 如CvScalar *pt=new CvScalar[320*240]; 此时将保存在堆内存中。Windows操作系统堆和栈的区别堆和栈的区别一、预备知识—程序的内存分配一个由c/C++编译的程序占用的内存分为以下几个部分1、栈区(stack)— 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等。其操作方式类似于数据结构中的栈。2、堆区 阅读全文
posted @ 2011-06-14 19:32 JustDoIt0 阅读(989) 评论(2) 推荐(0)
摘要:Counterfeit DollarTime Limit:1000MSMemory Limit:10000KTotal Submissions:29060Accepted:9114DescriptionSally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are true silver dollars; one coin is counterfeit even though its color and size make it indistinguishable from the r 阅读全文
posted @ 2011-06-07 12:39 JustDoIt0 阅读(317) 评论(1) 推荐(0)
摘要:/**威佐夫博奕(Wythoff Game):有两堆各若干个物品,两个人轮流从某一堆或同时从两*堆中取同样多的物品,规定每次至少取一个,多者不限,最后取光者得胜.*(ak,bk)(ak≤bk ,k=0,1,2,...,n)表示两堆物品的数量,则*奇异局面(先手必败,P-Position) ak =[k(1+√5)/2], bk= ak + k (k=0,1,2,...,n方括*号表示取整函数)*/以下是极为简短代码#include <iostream>#include <string>#include <algorithm>#include <cmat 阅读全文
posted @ 2011-06-06 19:50 JustDoIt0 阅读(350) 评论(0) 推荐(0)
摘要:DividingTime Limit:1000MSMemory Limit:10000KTotal Submissions:38124Accepted:9377DescriptionMarsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the marbles. This would be easy if all the marbles had the same value, bec 阅读全文
posted @ 2011-06-05 13:43 JustDoIt0 阅读(359) 评论(0) 推荐(0)
摘要:纠结一个下午,发现自己真的是越来越菜了,以前做的很快的题竟然久战不下!以后得在poj上常练了!以下是源码,比较乱,难得整理了……回溯法的应用#include<iostream>#include <fstream>using namespace std;const int MAX=1000;int typeValue[MAX];int x[MAX];//每种对应的张数,回溯时用int xx[MAX];int Request[MAX];int maxKind=0;int totalStemps=100000;int maxValue=0;bool isTie=false;i 阅读全文
posted @ 2011-06-04 22:22 JustDoIt0 阅读(281) 评论(0) 推荐(0)