哪位dalao帮忙指点迷津(?
  • 板块学术版
  • 楼主atqiae
  • 当前回复6
  • 已保存回复6
  • 发布时间2022/11/18 19:19
  • 上次更新2023/10/27 02:30:33
查看原帖
哪位dalao帮忙指点迷津(?
389200
atqiae楼主2022/11/18 19:19

题目:https://www.luogu.com.cn/problem/P1061 求问哪里有错

#include<iostream>
#include<cstring>
using namespace std;
int s,t,w;
string c;
void j(int x,bool o)
{
	if(o==1)
	{
		c[x]++;
		o=0;
		if(c[x]==t-(w-1-x)+96)
		{
			c[x]=' ';
			o=1;
		}
	}
	if(j==0)
	{
		return;
	}
	j(x-1,o);
}
bool f()
{
	if(c[0]==t-(w-1)+96)
	{
		return 0;
	}
	for(int i=1;i<w;i++)
	{
		if(c[i]==' ')
		{
			c[i]=c[i-1]+1; 
		}
	}
	return 1;
}
int main()
{
	cin>>s>>t>>w;
	cin>>c;
	for(int i=0;i<5;i++)
	{
		j(w-1,1);
		if(!f())
		{
			break;
		}
		cout<<c<<endl;
	}
	return 0;
}
2022/11/18 19:19
加载中...