- 博客(9)
- 收藏
- 关注
原创 括号匹配I
Inuyasha得到了一个由"("和")"组成的字符串,比如"(())()","()","(()(()))"是括号匹配的,而")(","(()","(()))("是括号不匹配的。为了让这个字符串括号匹配,Inuyasha可以去除某些括号。他想知道,他能得到的最长的括号匹配的字符串有多长?Input本题有多组测试数据,输入的第一行是一个整数T代表着测试数据的数
2013-10-24 12:59:30
662
原创 输出二进制数
Input第一行:输入数字T 表示接下来将有T组输入数据接下来T行,每行输入一个数字N (0Output输出该数字的二进制注意:0 输出 0Sample Input501234Sample Output011011100#include #include vo
2013-10-24 12:57:46
777
原创 摆布大三角
73 88 1 02 7 4 44 5 2 6 5(Figure 1)Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that starts at the t
2013-10-24 12:56:10
831
原创 绝对值
小灰灰又不开心了,因为他老爸灰太狼又要他做作业了,做不出来不给羊吃,怎么办呢?小灰灰跟聪明的你是好朋友,好朋友的你肯定不忍心看小灰灰这么不开心啦,所以你要帮他解决掉他的作业,题目如下:给定任意实数n, 要求输出n的绝对值 (-10^9 Input第一行,给定一个正整数T (0第二行,输入一个任意实数N;处理到文件结束;Output输出N的绝对值;Sample I
2013-10-24 12:53:22
570
原创 4.1E2
E2. Write the C++ statements that are needed to create the linked configuration of nodes shown in each of the flloeing diagrams.For each part,embed these statements as part of a program that printfs t
2013-09-05 17:31:52
470
原创 栈
栈的练习书上例题:#include#includeusing namespace std;const int maxstack=10;enum error_code{ stack(),bool empty()const,pop(),top(Stack_entry&item)const,push(const Stack_entry&item)};clas
2013-08-28 20:54:06
502
原创 括号匹配
#include#includechar str[1000005],ttr[1000005];int main(){ int x,len,i,k,flag,ji; scanf("%d",&x); getchar(); while(x--) { flag=0; gets(str); ji=0; len
2013-08-28 20:35:41
449
1
原创 初学 栈的定义
标准模板库:#include#includeusing namespace std;int main(){ int n; double item; stacknumbers; cout cin>>n; for(int i=0;i { cin>>item;
2013-08-27 20:15:54
412
原创 第一章
本章首先概述良好程序设计的重要原理,特别是它们在大型项目中的应用;然后介绍用于发现有效算法的方法。一)学习数据结构:• c++允许数据抽象:这意味着程序设计员能创造新的类型来表达方便其应用程序的任何数据集合。• c++支持面向对象的设计,在面向对象的设计中,程序设计员定义的类型在算法实现中起到中心作用.. 重要的是,正如允许面向对象的方法, c++ 允许使用自顶向下的方法,
2013-08-24 14:37:14
378
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人