#include
using namespace std;
//定义一个函数,用于交换两个变量的值
void swap(int &a, int &b);
void main()
{
int i = 3, j = 5;
cout<<"交换前:i="<<i<<" j="<<j<<endl;
swap(i,j);
cout<<"交换后:i="<<i<<" j="<<j<<endl;...
分类:
其他好文 时间:
2014-05-18 16:05:54
阅读次数:
209
题目描述
输入二叉树的先序遍历序列和中序遍历序列,输出该二叉树的后序遍历序列。
输入
第一行输入二叉树的先序遍历序列;
第二行输入二叉树的中序遍历序列。
输出
输出该二叉树的后序遍历序列。
示例输入
ABDCEF
BDAECF
示例输出
DBEFCA#include
#include
#define MAX 50+3
using namespace std;
typede...
分类:
其他好文 时间:
2014-05-18 15:59:41
阅读次数:
185
题目:
链接:点击打开链接
算法:
完全背包。
状态转移方程: dp[j] += dp[j-i];dp[j]表示钱j可以兑换的方法,,,,,i是硬币的价值1,2,3,,,个数是不限的
代码:
#include
#include
#include
using namespace std;
int dp[40000];
int n;
int main(...
分类:
其他好文 时间:
2014-05-18 15:43:08
阅读次数:
265
A、Choosing Teams
水题
#include
#include
using namespace std;
int main()
{
int n, k, ans, i, x;
scanf("%d%d",&n,&k);
ans = 0;
for(i=0; i<n; ++i)
{
scanf("%d",&x);...
分类:
其他好文 时间:
2014-05-18 10:53:23
阅读次数:
262
实现操作
(1)二叉搜索树的建立
(2)二叉搜索树的插入
(3)二叉搜索树的三种递归遍历(前序、中序和后续)
(4)二叉搜索树的三种非递归遍历(前序、中序和后续)
(5)二叉搜索树的逐层打印
有时间再实现:
(6)二叉搜索树的前驱和后继查找
(7)二叉搜索树的删除
源码分析:
#include
#include
#include
using namespace st...
分类:
编程语言 时间:
2014-05-18 10:28:47
阅读次数:
492
A:A. Choosing Teams
.题目就不介绍了,直接统计即可。
AC代码:
#include
#include
#include
using namespace std;
int cnt[6];
int main()
{
int n,k,i,x;
while(cin>>n>>k)
{
memset(cnt,0,sizeof(cnt));...
分类:
其他好文 时间:
2014-05-18 08:41:02
阅读次数:
233
C++对象模型内存布局如下:
非静态数据成员在对象之内静态数据成员在对象之外静态、非静态成员函数在对象之外类中存在虚函数时,一个类对应一个virtual table放在对象之外,对象中安插一个指针vptr指向这个表。
测试例程:
#include
using namespace std;
class A {
public:
int x, y;
static...
分类:
编程语言 时间:
2014-05-18 07:46:31
阅读次数:
234
都不知道怎么分类了。
大概要求一个树中以某个结点为根的子树结点个数,还有儿子结点中以儿子结点为根的子树结点个数的最大值,用递归得到n[i],以i为根节点的子树结点个数
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define scan(a) scanf("...
分类:
其他好文 时间:
2014-05-18 07:26:01
阅读次数:
225
this bundle is invalid . new apps and app updates submitted to the app store must be built with public...
分类:
移动开发 时间:
2014-05-18 04:57:16
阅读次数:
341
题目一:求1!+2!+…..+n! 的和的后6位,(注意n的范围)
#include
using namespace std;
const int MAX = 1000000;
int getResu(int n)
{
int sum=0;
int temp= 1;
for(int i=1; i <= n; i++)
{
temp *= i;
temp %= MAX;
...
分类:
其他好文 时间:
2014-05-18 03:36:19
阅读次数:
223