Problem Description推断两序列是否为同一二叉搜索树序列Input開始一个数n,(1#include #include using std::string;using std::cin;const int SIZE = (1>root; for (int i = 0; i >chi....
分类:
其他好文 时间:
2014-07-11 18:44:26
阅读次数:
205
题目标题:
计算两个字符串的最大公共字串的长度,字符不区分大小写
输入两个字符串
输出一个整数
案例输入:asdfas werasdfaswer
案例输出:6
#include
#include
using namespace std;
int main()
{
string str1,str2,temp;
int m,MaxNum=0,Len;
cin>>str1>>str...
分类:
其他好文 时间:
2014-07-09 12:16:39
阅读次数:
416
#include using namespace std;int main(int argc, const char * argv[]){//cin接收键盘输入 int age; double height; char name[10];// cout 在控制台输出一些信息// 相当于c语...
分类:
编程语言 时间:
2014-07-09 00:37:35
阅读次数:
270
最近在练机试题,常用的C和C++输入输出如下:1 scanf 和printfint a; scanf("%d",&a) ; printf("%d",a); printf("\n");double b;scanf("%");char c; scanf("%c",&c);printf("%c",c);l...
分类:
其他好文 时间:
2014-07-08 22:53:52
阅读次数:
257
哈哈哈,简单polya,公式自己推导。
不过这题需要用到大数,很久没写Java,调了好久。
import java.math.*;
import java.util.*;
import java.io.*;
public class Main{
public static void main(String args[]){
Scanner cin=new Scanner(Syst...
分类:
其他好文 时间:
2014-07-08 14:45:59
阅读次数:
240
题目:构造n位01串,其中有m个1的所有组合。
分析:搜索、枚举。可以利用库函数,求解,也可以利用dfs求解;我这里采用位运算计算组合数。
说明:注意库啊!
#include
#include
#include
using namespace std;
int S[20];
int main()
{
int T,N,M;
while ( cin >> T )
for ( i...
分类:
其他好文 时间:
2014-07-08 11:24:33
阅读次数:
199
#include<iostream>
#include<string>
#include<algorithm>
usingnamespacestd;
voidtongji()
{
stringinput;
stringoutput;
getline(cin,input);//读入带空格的字符串
intn;
n=input.size();//求字符串的大小
inta[255]={0};
intb[255]={0};
bo..
分类:
其他好文 时间:
2014-07-08 09:16:59
阅读次数:
218
#include<iostream>
usingnamespacestd;
structnode{
intd;
structnode*next;
};//定义结点
node*build1()//头插法构造单链表
{
node*p;//指向新建结点
node*head;//头指针
head=NULL;
p=head;
intx;
cin>>x;
while(x!=-1)
{
p=newnode;
p->d=x;
p-&g..
分类:
其他好文 时间:
2014-07-08 09:06:06
阅读次数:
220
字符串的输入有6中方式,这六种方式各有各的特点,我这篇学习笔记是自己的经验总结,没有去探讨内存,函数库等的复杂问题,仅仅是为了实用:第一:cincin一次接受一个字符,所以有的人会选择定义一个字符型数组,然后用cin循环进行输入,但是cin的局限性是:遇到空格就会停止接受字符;第二:ch1=cin....
分类:
编程语言 时间:
2014-07-06 21:36:20
阅读次数:
245
一、最基本的用法cin>>
接收一个数字、字符、字符串,遇“空格”、“TAB”、“回车”都结束
例如: #include
using namespace std;
main ()
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
}输入:5[回车]6[回车]
输出:11
(其中回车可替换成空格或者TA...
分类:
编程语言 时间:
2014-07-06 00:16:27
阅读次数:
270