大一寒假训练:string

一、使用详解:

这里是跳转链接o()q

二、习题&题解(共八题):

格式:题号——题名——[AC/Submit]

先来几道水题找找感觉o( ̄▽ ̄)o

A 字符串合并-string [59/61]

#include <bits/stdc++.h>
using namespace std;
string str1, str2;
int main()
{
   
    ios::sync_with_stdio(false);
    while (cin >> str1 >> str2)
    {
   
        str1 += str2;
        cout << str1 << endl;
    }
    //system("pause");
    return 0;
}

B 回文字符串-string [58/70]

#include <bits/stdc++.h>
using namespace std;
string str1, str2;
string::iterator it1, it2;
int main()
{
   
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    while (n--)
    {
   
        cin >> str1;
        str2 = str1;
        it1 = str1.begin();
        it2 = str1.end();
        reverse(it1, it2);
        if (str1 == str2)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    //system("pause");
    return 0;
}

C 气球-string-map [59/82]

直接暴力

#include <bits/stdc++.h>
using namespace std;
int n, t2;
string str[200], ansstr;
int main()
{
   
    ios::sync_with_stdio(false);
    while (cin 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值