AtCoder Beginner Contest 337

B - Extended ABC

image

必须是以abc的大小拼起来才是符合的

#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int n=s.size();
	for(int i=1;i<n;i++){
		if(s[i]!=s[i-1]){
			if(s[i]<s[i-1]){
				cout<<"No\n";
				return 0; 
			}
		} 
	}
	cout<<"Yes\n"; 
	return 0;
}

C - Lining Up 2

image
image

意思是i是排在a[i]后面的,从-1的点开始递归就行了

#include<bits/stdc++.h>
using namespace std;
const int N=3e5+10;
void solve(){
	int n;
	cin>>n;
	map<int,int>mp;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		mp[x]=i;
	}
	int cnt=0;
	int k=-1;
	while(1){
		cnt++;
		if(cnt==n+1)break;
		cout<<mp[k]<<" ";
		k=mp[k];
	}
}
int main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int t=1;
	//cin>>t;
	for(int i=1;i<=t;i++)solve();
	return 0;
} 

本文作者:yufan1102

本文链接:https://www.cnblogs.com/yufan1102/p/18005321

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   yufan1102  阅读(18)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起
  1. 1 404 not found REOL
404 not found - REOL
00:00 / 00:00
An audio error has occurred.