我的devc++和洛谷运行结果不一样...求大佬帮助..
查看原帖
我的devc++和洛谷运行结果不一样...求大佬帮助..
67476
kasugano_sora楼主2021/9/25 23:45
#include<iostream>
#include<cstring>
using namespace std;
int head,t,k;
char a[10000001];
int main()
{
	while((a[++t]=getchar())!='\n' and a[t]!=' ');
	t--;
	cin>>k;
	for(int i=1;i<=k;i++)
	{
		head=1;
		while(a[head]<=a[head+1])
		{
			head++;
		}
		if(head==t) t--;
		else
		{
			for(int j=head;j<=t-1;j++)
			{
				a[j]=a[j+1];
			}
			t--;
		}
	}
	int length=t;
	if(a[1]=='0' and t<=5)
	{
		cout<<"0";
	}
	else
	{
		for(int i=1;i<=t;i++)
		{
			if(i==1)
			{
				while(a[i]=='0')
				{
					i++;
				}
			}
			cout<<a[i];
		}
	}
}
2021/9/25 23:45
加载中...