//自信满满地交上去~~but。。。超时了

#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std; int main()
{
char ch[],c;
int i,k,j;
cin>>i;
while(i)
{
cin>>ch;
for(k=;k<strlen(ch);)
{
if(ch[k]!=ch[k+])
{cout<<ch[k];k++;}
else
{
c=ch[k];
for(j=k;ch[k]&&ch[j]==c;j++);
cout<<j-k<<c;
k=j;
}
}
cout<<endl;
i--;
}
return ;
}

//于是。。。重来。。。orz
//这是借鉴大神的。。。。发现自己的思路好单一。。。。。

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std; int main()
{
int n,i,cnt;
char str[];
cin >> n;
while(n--)
{
cin >> str;
for(i = ; str[i]!='\0';)
{
cnt = ;
while(str[i] == str[i+])
{
cnt++;
i++;
}
if(cnt == )
cout << str[i];
else
cout << cnt << str[i];
i++;
}
cout << endl;
} return ;
}

hdu 1020的更多相关文章

  1. HDU 1020:Encoding

    pid=1020">Encoding Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Ja ...

  2. hdu 1020 Encoding

    Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Description Given a ...

  3. HDU 1020 Encoding POJ 3438 Look and Say

    Encoding Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Su ...

  4. HDU 1020(连续同字符统计 **)

    题意是要统计在一段字符串中连续相同的字符,不用再排序,相等但不连续的字符要分开输出,不用合在一起,之前用了桶排序的方法一直 wa,想复杂了. 代码如下: #include <bits/stdc+ ...

  5. HDU 1020 Encoding 模拟

    Encoding Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Su ...

  6. HDU 1020.Encoding-字符压缩

    Encoding Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Su ...

  7. HDU 1020 Encoding【连续的计数器重置】

    Encoding Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Su ...

  8. HDU字符串基础题(1020,1039,1062,1088,1161,1200,2017)

    并不是很精简,随便改改A过了就没有再简化了. 1020. Problem Description Given a string containing only 'A' - 'Z', we could ...

  9. HDU——PKU题目分类

    HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...

随机推荐

  1. use ContourPlot-使用ContourPlot

    use ContourPlot to draw implicit function graphics 使用ContourPlot 画隐函数图像 for example $x^{3}+y^{3}-3xy ...

  2. jfianl返回自定义的404页面

    public class MyErrorRenderFactory implements IErrorRenderFactory{ public Render getRender(int errorC ...

  3. 用juery的ajax方法调用aspx.cs页面中的webmethod方法示例

    juery的ajax调用aspx.cs页面中的webmethod方法:首先在 aspx.cs文件里建一个公开的静态方法,然后加上WebMethod属性,具体实现如下,感兴趣的朋友可以参考下哈,希望对大 ...

  4. Linux_Cytoscape

  5. Ubuntu Git服务器搭建

    1.安装git和ssh工具 apt-get install git-core openssh-server openssh-client 2.添加用户名为git的用户 useradd -m git 3 ...

  6. 《Javascript网页经典特性300例》

    <Javascript网页经典特性300例> 基础篇 第1章:网页特性 刷新.后退.前进.关闭.标题.跳转禁止网页放入框架动态加载js避免浏览器使用缓存加载页面 第2章:DOM操作 根据n ...

  7. 《JS权威指南学习总结--开始简介》

    本书共分成了四大部分: 1.JS语言核心 2.客户端JS 3.JS核心参考 4.客户端JS核心参考 其中 <JS权威指南学习总结--1.1语法核心> 是:第一部分JS语言核心 各章节重点 ...

  8. Qml 定义 constant

    对于程序中一些常量如字符串, 实数等, C++中经常用的方法, 是定义全局常量: 或者把所有意义相近的常量用一个单例类收集起来. QML是类JSON的标识性语言, 使用js 语法去操作对象. 在QML ...

  9. bzoj2052: Pku1777 Vivian

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2052 2052: Pku1777 Vivian Time Limit: 10 Sec  M ...

  10. hdu_5969_最大的位或(贪心)

    题目链接:hdu_5969_最大的位或 题意: 中文,还是自己看 题解: xjb贪心一下就行了 #include<bits/stdc++.h> #define F(i,a,b) for(i ...