利用栈判断输入的表达式中的括号是否匹配(假设只含有左、右括号)
bool Match(char exp[],int n)
{
int i=0;
char e;
bool match=true;
SqStack *st;
InitStack(st);//初始化栈
while(i
{
if(exp[i]=='(')//当前字符为左括号,将其...
分类:
其他好文 时间:
2014-08-06 10:31:59
阅读次数:
225
http://acm.hdu.edu.cn/showproblem.php?pid=3277题意:有2N个孩子,其中有N个女生,N个男生,每一个女生可以找一个没有争吵过得男生组成一个家庭,并且可以和与她关系好的女生互换男生。与HDU 3081 Marriage Match II不同的是,女生交换朋友...
分类:
其他好文 时间:
2014-08-04 17:25:47
阅读次数:
219
一个int占多少个字节?这个问题我们往往得到的答案是4.可是int究竟占多少个字节,却跟你的机器环境有关.As you can see, the typical data type sizes match the ILP32LL model, which is what most compilers...
分类:
其他好文 时间:
2014-08-03 20:32:25
阅读次数:
233
定义一个布局文件
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height=...
分类:
移动开发 时间:
2014-08-03 15:25:05
阅读次数:
204
Match for Bonus
Time Limit: 2 Seconds Memory Limit: 65536 KB
Roy played a game with his roommates the other day.
His roommates wrote 2 strings of characters, and gave each character a b...
分类:
其他好文 时间:
2014-08-02 18:20:33
阅读次数:
256
布局文件中定义一下UI,虽然没什么UI.....
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
androi...
分类:
移动开发 时间:
2014-08-02 15:40:23
阅读次数:
301
先上效果图:
Layout文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
and...
分类:
移动开发 时间:
2014-08-01 23:18:22
阅读次数:
489
//1.js验证只能输入数字.
functioncheck_validate1(value){
//定义正则表达式部分
varreg=/^\d+$/;
if(value.constructor===String){
varre=value.match(reg);
returntrue;
}
returnfalse;
}
//2.js验证只能输入字母.数字和下划线.
functioncheck_validate2(value){
varreg=/^\..
分类:
Web程序 时间:
2014-08-01 20:06:42
阅读次数:
259
http://acm.hdu.edu.cn/showproblem.php?pid=3081题意:有2N个孩子,其中有N个女生,N个男生,每一个女生可以找一个没有争吵过得男生组成一个家庭,并且可以和与她关系好的女生互换男生。问能交换多少次。题解:最少交换0次,最多交换2*N次。需要用并查集处理好女生...
分类:
其他好文 时间:
2014-08-01 18:35:32
阅读次数:
268
有时我们在做多行EditText的时候会出现光标在中间的问题:
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="5"
android:background="#ffffff"
android:paddi...
分类:
其他好文 时间:
2014-07-31 21:03:17
阅读次数:
308