HDU1020_Encoding

【Python学习日记:PySide6】【持续更新】 说明:PySide6 是 Qt for Python 的一部分,是一个 Python 绑定库,可以用来创建跨平台的 GUI 应用程序。它将 Qt 框架的丰富功能带到了 Python 环境中,允许开发者使用 Python 编写 GUI 应用程序。 阅读详情

Encoding

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 41886    Accepted Submission(s): 18523


Problem Description
Given a string containing only 'A' - 'Z', we could encode it using the following method: 

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.
 

Input
The first line contains an integer N (1 <= N <= 100) which indicates the number of test cases. The next N lines contain N strings. Each string consists of only 'A' - 'Z' and the length is less than 10000.
 

Output
For each test case, output the encoded string in a line.
 

Sample Input
  
2 ABC ABBCCC
 

Sample Output
  
ABC A2B3C
 

Author
ZHANG Zheng
 

Recommend
JGShining


#include<stdio.h>

int main()
{
    char a[10010];
    int i,t;
    int T;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%s",&a);
        i=0;
        while(a[i]!='\0')
        {
            t=i;
            while(a[t+1]==a[i])
            {
                t++;
            }    
            if(t>i)printf("%d",t-i+1);
            printf("%c",a[i]);
            i=t;
            i++;
        } 
        printf("\n");   
    } 
    return 0;   
}    


博通PEX89000 PCIe 5.0交换芯片:如何为AI集群构建高效GPU互联架构 本文深入解析了博通PEX89000 PCIe 5.0交换芯片如何为AI集群构建高效的GPU互联架构。该芯片通过提供高带宽、低延迟的PCIe 5.0交换能力,打破传统GPU通信的带宽瓶颈,并支持多主机共享、资源池化及软件定义拓扑,从而显著提升大规模AI训练与推理任务的效率与资源利用率。 阅读详情

相关推荐

泛微Ecology流程数据表结构解析:workflow_requestbase和workflow_currentoperator到底怎么关联查询?

本文深入解析泛微Ecology系统中workflow_requestbase和workflow_currentoperator表的结构与关联机制,提供SQL查询语句示例,帮助开发者高效查询流程数据。涵盖待办事项、已办事项、办结事项和流程监控等典型场景,并分享性能优化技巧和常见问题排查指南。

weixin_33738555的博客 816

HDU-1020-Encoding(Java && 弱水三千)

Encoding Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 31603    Accepted Submission(s): 14020 Problem Description Given a string

保持对编程的热情! 976

深入浅出:CosineLRScheduler 调度器的原理与实战应用

本文深入解析了CosineLRScheduler调度器的核心原理与实战应用,详细介绍了余弦退火算法及其在深度学习模型训练中的优势。通过参数配置建议、PyTorch实现示例和常见问题解决方案,帮助开发者高效应用该调度器提升模型性能,特别适用于计算机视觉和自然语言处理任务。

sss66的博客 859

hdu1020 Encoding

http://acm.hdu.edu.cn/showproblem.php?pid=1020 过了的就是好孩子。。。。。。。。 1 #include 2 #include 3 #includestring.h> 4 #include 5 #include 6 #include 7 using namespace std; 8 const int N=10005

xuesen1995的专栏 232

从波士顿动力SpotMini拆解看四足机器人机械设计:关节布局与电机选型的5个关键决策点

本文深入解析波士顿动力SpotMini四足机器人的机械设计,聚焦关节布局与电机选型的5个关键决策点。通过拆解髋关节偏移距、膝关节传动链、电机热管理等核心设计,揭示商业级四足机器人的工程智慧,为工业巡检、物流机器人等应用提供实用参考。

postgres8guard的博客 896

运放 + MOS管构成的恒流电路分析及实用环境器件参数选择

恒流电路

五花带点肉 2万+

hdu 1020 Encoding

hdu  1020  Encoding               题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1020 简单模拟 题目大意:把邻近的相同元素收成一格并在其前输出此元素个数(1省略)。 题目分析:无技术含量,模拟水过。 #include #include using namespace std; int main() {

slicer的技术交流栈 724

【Benchmark 性能测试全指南:从核心原理到 CINEBENCH 实战解析】

本文深度拆解基准测试(Benchmark)的底层逻辑,详解数据集、工作负载、度量指标三大核心要素,分步演示测试流程与统计分析要点。结合 CINEBENCH R23 实战案例,揭秘 CPU 性能评估方法论,助你掌握系统性能量化与优化的核心技能。

rong_ha_ha的博客 6334

hdu1020Encoding

题目链接 题目不难,核心在于理解题意,不是统计字符串中出现的所有字符的个数,而是统计相邻的个数; wa代码: #pragma warning(disable:4996); #include <iostream> #include<stdio.h> #include<string.h> #include<algorithm> #include<q...

Roxannekkk的博客 257

如何实现电路级别的CDM ESD防护

采用先进制程的CMOS工艺,可能具有比以前更薄的栅极氧化物和更大的芯片尺寸,大的衬底可能积累大量的电荷,导致CDM事件期间的高ESD放电峰值电流。传统CDM保护器件使用栅极接地NMOS被添加到输入级的栅极。然而,这种方法通常会在信号路径上引入显著的寄生电容,这不适合RF应用。

weixin_42693135的博客 2504

代谢组数据分析(三):代谢组降维分析

本文详细介绍了代谢组学中常用的降维分析方法,包括PCA、PLS-DA和OPLS-DA。PCA通过线性变换降低数据维度,便于数据可视化和异常值检测;PLS-DA是一种有监督的模式识别方法,适用于分类和预测;OPLS-DA通过正交分解避免过拟合,更准确地筛选差异代谢物。降维分析在揭示样本间差异和发现生物标志物方面具有重要意义

专注生信领域 3792

hdu 1020 Encoding

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1020   题目描述: Encoding Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 18849    Accepted Sub

心之所向,无惧无悔! 1048

第4章 部署负载均衡 Keepalived + HAProxy

本章在所有 Master 节点部署 Keepalived + HAProxy,为 kube-apiserver 提供高可用入口。Keepalived 实现 VIP(192.168.3.59)漂移,HAProxy 轮询转发请求至三个 Master 的 6443 端口(监听 6444 避免冲突)。健康检查脚本连续 5 次失败则停止 Keepalived,触发 VIP 自动切换。本章还包含配置详解、日常运维和问题排查。

幸福街--linux技术分享 123

HDU 1020 Encoding

题目: http://acm.hdu.edu.cn/showproblem.php?pid=1020 题解: 直接

YLSpace 802

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

HDU1020——Encoding,HDU1021——Fibonacci Again,HDU1022——Train Problem I

这个函数实现了斐波那契数列的一个变体。斐波那契数列通常定义为。,之后每一项都是前两项的和。但在这个变体中,起始的两个数分别是。:此函数用于检查是否能够按照给定的出站顺序(根据FN函数推断出n的规律,进行总结归纳。函数会被调用来显示火车调度的具体步骤。:这是程序的入口点,它读取输入并调用。,表示将要处理的字符串数量。:首先,代码读取一个整数。来模拟车站中的火车。

u014114223的博客 847

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

HDU-1020 Encoding

HDU-1020 Encoding 问题描述: Given a string containing only ‘A’ - ‘Z’, we could encode it using the following method: Each sub-string containing k same characters should be encoded to “kX” where “X” is the only character in this sub-string. If the length o

m0_51727949的博客 299

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

HDU1020 Encoding

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1020 #include<iostream> #include <string> using namespace std; void doProcess(string& str) { int count,i,j; ...

weixin_34186931的博客 121

HDU 1020 - Encoding

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 s

Fisher_Collect的专栏 452

hdu 1020 Encoding(模拟)

http://acm.hdu.edu.cn/showproblem.php?pid=1020 /* 2011-9-9 author:BearFly1990 */ package acm.hdu.tests; import java.io.BufferedInputStream

602

[Hdu1020] Encoding

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1020 题目大意: 输入A-Z,统计输出kx,x是输入的字符,k是输入连续相同的x的和,若k为1就不用输出k; 解题思路: 先把所有字符存到数组a里,i作为它的下标,用t从开始记录第一个字符的下标;然后判断a[t+1]是否等于a[i]; 要等于就 t++,继续判断;不等于就输出...

weixin_33728268的博客 87

hdu_1020 Encoding(简单题)

http://acm.hdu.edu.cn/showproblem.php?pid=1020   分析: 遍历   代码: #include #include #include #include #include #define LL long long using namespace std; int main() { int n; string s; sca

naturelan的专栏 682

HDU 1020 Encoding

  Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 57816    Accepted Submission(s): 25811   Problem Description Given a string containing onl...

Rem_little_fan_boy的博客 287

HDU 1020 — Encoding

原题:http://acm.hdu.edu.cn/showproblem.php?pid=1020 题意:计算字符串中各字母的个数,1不必标记; #include #include char s[10005]; int main() { int cas; scanf("%d", &cas); while(cas--) { scanf("%s", s); int len

吧唧吧唧 619
下一篇: HDU1040_As Easy As A+B
ZayneHuang
博客等级 码龄10年 5粉丝 116原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值