寒假集训作业(4)——字符串

这篇博客主要分享了寒假集训期间的三道字符串处理题目,涉及ACM竞赛中的字符串操作。作者采用了插入排序算法进行解答,并强调了在处理分数与名字数组同步排序时的注意事项,提供了详细的问题链接供读者参考。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1916

#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
int main()
{
    char str[1100],ch;
    int t,k,i;
    cin>>t;
    while(t--)
    {
        cin>>str;
        for(i=0;i<strlen(str);i++)
        {
            if(str[i]!='-') cout<<str[i];//out put as disired...
            else//str[i]=='-'
            {
                if((str[i-1]>='0'&&str[i-1]<='9')&&(str[i+1]>='0'&&str[i+1]<='9')&&(str[i-1]<=str[i+1]))//digit,left one and right one is also digit and left<right...
                {
                    ch=str[i-1]+1;//ascii+1 from left one to the right one
                    while(ch<str[i+1])
                    {
                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值