hdu_1020_Encoding_201310172120
Encoding
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 22110 Accepted Submission(s): 9687
1. Each sub-string containing k same characters should be encoded to "kX" where "X" is the only character in this sub-string.
2. If the length of the sub-string is 1, '1' should be ignored.
#include <stdio.h>
#include <string.h> char str[]; int main()
{
int cases;
scanf("%d",&cases);
getchar();
while(cases--)
{
int i,len,count=;
char c;
scanf("%s",str);
len=strlen(str);
i=;c=str[i];
while(i<len)
{
while(str[i+] == c)
{
count++;
i++;
}
if(count)
{
printf("%d%c",count+,c);
count = ;
c = str[i+];
}
else
{
printf("%c",c);
count = ;
c = str[i+];
}
i++;
}
printf("\n");
}
return ;
}
做过,水过!
hdu_1020_Encoding_201310172120的更多相关文章
随机推荐
- es6 import 与 export
1.export 命令 export 命令用于规定模块的对外接口. 一个模块就是一个独立的文件.该文件内部所有的变量,外部无法获取.要想外部能够读取模块内部的某个变量,就必须使用 export 关键字 ...
- codevs3002石子归并3(四边形不等式优化dp)
3002 石子归并 3 参考 http://it.dgzx.net/drkt/oszt/zltk/yxlw/dongtai3.htm 时间限制: 1 s 空间限制: 256000 KB 题目等级 ...
- SpringBoot 热部署 + IDEA
1.使用Spring-Boot-Devtools实现热加载(这种方式会自动重启) devtools的原理: 深层原理是使用了两个ClassLoader,一个Classloader加载那些不会改变的类( ...
- B树、B+树、红黑树、AVL树比较
B树是为了提高磁盘或外部存储设备查找效率而产生的一种多路平衡查找树. B+树为B树的变形结构,用于大多数数据库或文件系统的存储而设计. B树相对于红黑树的区别 在大规模数据存储的时候,红黑树往往出现由 ...
- Microsoft SQL Server学习(二)--数据库的语法
关于数据库的语法 创建数据库 样例 名词概念 编写数据库代码的注意事项 关于文件语法 实例代码 关于数据库的语法: 1.创建数据库 create database 数据库名 on primary (主 ...
- java攻城师之路--复习java web之servlet
需要掌握的知识点:1.Servlet程序编写 ----- 生命周期2.ServletAPI Request Response 3.Cookie 和 Session Servlet 用来 动态web资源 ...
- Java_Web三大框架之Hibernate+jsp+selvect+HQL查询数据
俗话说:"好记性不如烂笔头".本人学习Hibernate也有一个星期了,对Hibernate也有一个初步的了解.下面对Hibernate显示数据做个笔记,使用租房系统的Hibern ...
- iDRAC RAC0218 最大会话限制
用ssh工具登陆IDRAC远程管理ip地址: /admin1-> racadm racreset RAC reset operation initated successfully. It m ...
- -bash:whois:command not found
在centOS 下,如果出现-bash:whois:command not found的问题, 则yum install 安装whois软件 yum install -y jwhois 包名是jwho ...
- CAD在网页中得到批注信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 3 ...