84分#7WA,本地输出正确
查看原帖
84分#7WA,本地输出正确
682376
Yu3yu2yu3楼主2025/8/29 22:35
#include <bits/stdc++.h>
using namespace std;

int K;
string s;

int main()
{
	cin >> s;
	cin >> K;
	s = s+':';
	
	int lpos = -1, n = s.size() - 1, pos = n, m = K, cnt = 0;
	bool flag;
	for (int i = 0; i < n; i++)
	{
		
		if (m == 0)
		{
			for (int j = i; j < n; j++)
				cout << s[j];
			flag = true;
			break;
		}
		cnt++;
		if (s[i] < s[pos])
		{
			pos = i;
		}
		if (cnt > m)
		{
			if (s[pos] != '0')
			{
				cout << s[pos];
				flag = true;
			}
			m -= pos - lpos - 1,
			cnt = 0,
			lpos = pos, pos = n,
			i = lpos;
		}
	}
	
	if (!flag) cout << 0 << endl;
	else cout << endl;
	return 0;
}

rt,下载了数据,本地可以正常输出0

2025/8/29 22:35
加载中...