HDU 1020 - Encoding
2015-07-22 11:20
483 查看
HDU 1020 - Encoding
Easy Problems -_-||Input:
AABBBCDDDD
Output:
2A3BC4D
To practice more and simple example of input and output, not exactly algorithm, just practice. ..
*. -> Using string (char array) may be better.
#include<iostream> #include<cstdio> using namespace std; void fRead(char cPrevious) { char a; int t = 1; while(true) { scanf("%c", &a); if(cPrevious == a) t++; else break; } if(t == 1) cout << cPrevious; else cout << t << cPrevious; if(a == '\n') cout << endl; else fRead(a); } int main() { int n; char a; scanf("%d", &n); while(n--) { scanf("%c", &a); scanf("%c", &a); fRead(a); } }
相关文章推荐
- 培训管理模块
- 菜鸟vimer成长记——第2.1章、normal模式
- SQL 同一个表中 根据一列更新另一列(不同行)
- 内存泄露
- 用GruntJS合并、压缩JS文件
- 从一个activity返回
- Slope One简单高效的协同过滤算法
- Tomcat 6.x Perm区内存泄露问题
- C++常用术语及其英文翻译的含义和简单用途总结(三)
- codevs1050
- HDU 5289 Assignment (二分+RMQ) 2015多校训练一 1002
- LocalThread分析
- document.referrer的使用和window.opener 跟 window.parent 的区别
- JSF笔记----方法表达式加入参数
- 我的工作笔记之第一篇 (星云)
- C# vs 2015 to automate ONE
- 数据库主体在该数据库中拥有 架构,无法删除。
- oracle用户创建及权限设置
- 【C++】智能指针(Smart Pointer)
- 利用Eclipse构建Spark集成开发环境