玄
查看原帖
玄
1247040
V_HAPPY666楼主2024/8/29 12:57

为何DEV编译通过,洛谷和Atcoder显示CompileError?为何DEV编译通过,洛谷和Atcoder显示Compile Error?

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	int n,x;
	cin>>n>>x;
	char s[n+1];
	cin>>s;
	int l=strlen(s);
	for(int i=0;i<l;i++)
	{
		if(s[i]=='o')x++;
		if(s[i]=='x')x=max(0,x-1);
	}
	cout<<x;
	return 0;
}
2024/8/29 12:57
加载中...