随笔分类 - 栈
摘要:Train Problem ITime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8757Accepted Submission(s): 3221Problem DescriptionAs the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because
阅读全文
摘要:/* 做这道题之前我用了一上午头的时间都没有明白怎么变成后缀式,但是一旦知道后缀式怎么变成表达式的时候思路就很清晰了(感谢秦川同学,尚灿芳同学//scanf= =...,赵鹏同学对小的不离不弃不厌倦= =。。。); 转换成后缀式无非就是遵循保证优先级高或者是相等时候入栈的的先打出来(此题中即先出栈打印),遇到()时先把括号里的输出在输出括号外面的; */ #include<stdio.h> #include<stdlib.h> struct stack { char c[100]; int top; }; int Push ( struct stac...
阅读全文
摘要:1 #include<stdio.h> 2 #include<stdlib.h> 3 4 struct Lnode/*以为当时做的题目没有告诉我是多少位的数字所以我选择了长度不受限的链栈*/ 5 { 6 int num; 7 struct Lnode *next; 8 }; 9 10 int Push(struct Lnode *top , int x)//压入数据 11 { 12 struct Lnode *p = (struct Lnode*)malloc(sizeof(struct Lnode)); 13 p->nu...
阅读全文
摘要:/*其实完全不用建立结构体,但是由于刚学栈的结构体形式所以才用一下,希望王旭老师多多指教*/ #include<stdio.h> #include<stdlib.h> struct stack { int c[100]; int top; }; int Push ( struct stack *p,int n) { if( p->top == 49 ) return 0; else { p->top++; p->c[p->top] =n; return 1; ...
阅读全文

浙公网安备 33010602011771号