Complicated Translation 栈的模拟 hoj
2012-06-16 23:40
351 查看
/*对于这道题我表示非常无语。对getchar的用法不熟。 主要是读入字符的问题。然后将每个词入栈。再按顺序弹栈即可。 学会用getchar处理单个字符和对行数的控制。*/ #include <iostream> #include <stdio.h> using namespace std; int main() { int n,top; char a[1100]; char c; while(scanf("%d",&n)==1&&n) { getchar(); for(int i=0; i<n; i++) { top=0; while((c=getchar())!='\n') { if(c!=' ') { a[top++]=c; } else { while(top>=1) { top--; printf("%c",a[top]); } printf(" "); } } while(top>=1) { top--; printf("%c",a[top]); } printf("\n"); } } return 0; }
相关文章推荐
- 487-3279 hoj 模拟AC
- HOJ P-2244 Get the Colors(模拟+贪心)
- HOJ 2778 CPU scheduling(STL 优先级队列+模拟)
- HOJ 1456 Team Queue(用queue进行模拟)
- HOJ 12823 Swyper Keyboard (模拟)
- HOJ 1017 模拟约瑟夫问题
- hoj 3029 Dictionary 模拟队列
- HOJ 1004 Prime Palindromes(模拟+数学)
- [转]Siege:压力模拟/测试工具
- 在widget界面添加两个模拟时钟,添加的两个模拟时钟只有一个可以正常进入
- javascript:用脚本模拟鼠标事件
- 微信 模拟登陆 公众平台模拟登陆 获取图文 上传图片
- HDU 1034.Candy Sharing Game【又是模拟】【8月22】
- The 13th Zhejiang Provincial Collegiate Programming Contest-Defuse the Bomb(模拟)
- 第五十九节,模拟浏览器请求Python结合html基本格式
- zzuli 2126: tmk买礼物(模拟)
- STM32模拟IIC
- 7-1 查找书籍(20 分)(程序设计天梯赛模拟练习题)
- Java程序员认证模拟题及详细分析
- 利用JAVA写一段上传文件程序(模拟Ftp客户端)