hdu1020 Encoding
http://acm.hdu.edu.cn/showproblem.php?pid=1020
过了的就是好孩子。。。。。。。。
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>
#include<queue>
using namespace std;
const int N=;
char a[N],b[N];
int main()
{
//freopen("in.txt","r",stdin);
int n;
cin>>n;
while(n--)
{
memset(a,,sizeof(a));
memset(b,,sizeof(b));
scanf("%s",a);
int len=strlen(a);
if(len==)
{
printf("%s\n",a);
continue;
}
int t=,count=;
for(int i=;i<len;i++)
{
if(a[i+]!='\0')
{
if(a[i+]==a[i])
{
count++;//数数
continue;
}
}
if(count!=)
{
count+=;
int temp=count,k=;
while(temp!=)//计算位数
{
temp/=;
k++;
}
t--;
int h=k;
while(k)
{
b[t+k]=count%+'';//从后赋值,123先将3赋值到b
count/=;
k--;
}
t+=h+;//指向
}
b[t++]=a[i];
count=;
}
b[t]='\0';
printf("%s\n",b);
}
return ;
}
hdu1020 Encoding的更多相关文章
- [HDU1020] Encoding - 加密
Problem Description Given a string containing only 'A' - 'Z', we could encode it using the following ...
- (暴力求解)Encoding HDU1020
Encoding 链接:http://acm.hdu.edu.cn/showproblem.php?pid=1020 Time Limit: 2000/1000 MS (Java/Others) ...
- 2道acm编程题(2014):1.编写一个浏览器输入输出(hdu acm1088);2.encoding(hdu1020)
//1088(参考博客:http://blog.csdn.net/libin56842/article/details/8950688)//1.编写一个浏览器输入输出(hdu acm1088)://思 ...
- javac -encoding utf8 in linux
由于另外负责编码的同事用的是utf-8,我用的默认的编码格式gbk,在提交代码时,为了迁就他,我打算把格式用工具转成utf-8. 转化成果后,然后在make一下,发现javac -encoding u ...
- 创建Odoo8数据库时的“new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)“问题
Odoo8创建数据库时,显示如下错误信息: DataError: new encoding (UTF8) is incompatible with the encoding of the templa ...
- Node.js Base64 Encoding和Decoding
如何在Node.js中encode一个字符串呢?是否也像在PHP中使用base64_encode()一样简单? 在Node.js中有许多encoding字符串的方法,而不用像在JavaScript中那 ...
- java Properties异常:Malformed \uxxxx encoding.
昨天项目中遇到一个 java.lang.IllegalArgumentException: Malformed \uxxxx encoding.这样的一个异常,debug了一下发现是读取propert ...
- svn: Can't convert string from 'UTF-8' to native encoding 的解决办法(转)
http://www.cnblogs.com/xuxm2007/archive/2010/10/26/1861223.html svn 版本库中有文件是以中文字符命名的,在 Linux 下 check ...
- C# 字符编码类Encoding
在网络通信中,很多情况下都是将字符信息转成字节序列进行传输.将字符序列转为字节序列的过程称为编码.当这些字节传送到接收方,接收方需要逆向将字节序列转为字符序列.这个过程就是解码. 常见编码有ASCII ...
随机推荐
- Ubuntu14.04 开启MySQL的remote access
一旦开启MySQL的remote access, 即可实现在windows系统下连接ubuntu下的mysql 步骤如下: sudo vim /etc/mysql/my.cnf bind-addres ...
- mount.nfs: access denied by server while mounting localhost:/home/xuwq/minilinux/system
在执行命令如下: mount -t nfs localhost:/home/xuwq/minilinux/system /mnt 出现的错误: mount.nfs: access denied by ...
- Redis源码研究--跳表
-------------6月29日-------------------- 简单看了下跳表这一数据结构,理解起来很真实,效率可以和红黑树相比.我就喜欢这样的. typedef struct zski ...
- PHP:strpos()-返回字符串在另一个字符串中第一次出现的位置
strpos()函数返回字符串在另一个字符串中第一次出现的位置.如果没有找到该字符串,则返回false. 语法:strpos(sting, find [, start]) string ,必须,要搜索 ...
- 基于jQuery的判断iPad、iPhone、Android是横屏还是竖屏
function orient() {if (window.orientation == 90 || window.orientation == -90) {//ipad.iphone竖屏:Andri ...
- 图解 CSS: 理解样式表的逻辑(转载)
原文:http://www.cnblogs.com/del/archive/2009/02/01/1382141.html 样式表可以是外部的.内联的或嵌入的; 链接外部样式文件一般是:<lin ...
- WPF之旅(三)- 布局之StackPanel
说到WPF的界面布局,相信很多朋友都写过Html代码.在WPF中,大多数程序都使用类似Web的(flow)流布局.在使用流布局模型时,各种控件可以按特定的要求来排列,在窗口内容发生变化时,比如窗口大小 ...
- 【python】 开始第一个项目
根据这篇文章开始上手 http://www.oschina.net/translate/the-flask-mega-tutorial-part-i-hello-world 再加点东西 如果你的环境是 ...
- (菜鸟要飞系列)四,基于Asp.Net MVC5的后台管理系统(zTree绑定Json数据生成树)
上一次老师让我们用递归将中国城市镇县四级联动 显示在树上,那个时候就知道可以显示在zTree上,可是苦于对Json的不了解,对zTree的Api的不了解,一直没有做出来,只好将递归算法显示在了窗体上, ...
- SQL Server 2008导出数据为SQL脚本的操作步骤
以前我们要将一个表中的数据导出为脚本,那么只有在网上找一个导出数据的Script,然后运行就可以导出数据脚本了.现在在SQL Server 2008的Management Studio中增加了一个新特 ...