跳到正文

题解

题解:P11019 「LAOI-6」[太阳]] 请使用最新版手机 QQ 体验新功能

wanghaoyu120717约 1 分钟
原文
文章信息与版本

文章信息

发布
2024年9月8日
收录
2025年12月12日
更新
2026年11月11日
篇幅
约 1 分钟
获赞
4
题目
P11019

版本

  1. v1当前

根据题面描述,输入的格式为 [AaaBbbCcc......]]QingShiYongZuiXinBanShouJiQQTiYanXinGongNeng

也就是说,拼音的音序一定是在 [和]] 之间的大写字母,我们只要找[(而[一定是第 11 个字符)和]]之间的大写字母就行了

时间复杂度 ≤O(n)\le O(n)

代码:

C++
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
string s;
int w;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin>>s;
	w=s.find(']');
	cout<<'/';
	for(int i=1;i<=w;i++){
		if(s[i]>='A'&&s[i]<='Z'){
			cout<<char(s[i]-'A'+'a');
		}
	}
	return 0;
}

AC!