后五个点wa
查看原帖
后五个点wa
263314
阿布鲁派楼主2021/8/18 20:24

我寻思我也处理范文退格了呀

#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
}
char c[100005];
stack<char>a[100005],r;
int t,kpm,sum,q1,q2,ans;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	while(1){
		gets(c);
		int len=strlen(c);
		if(len==3&&c[0]=='E'&&c[1]=='O'&&c[2]=='F')break;
		q1++;
		for(int i=0;i<len;i++){
			if(c[i]=='<'&&!a[q1].empty())a[q1].pop();
			else if(c[i]!='\n')a[q1].push(c[i]);
		}
	}
	while(1){
		gets(c);
		int len=strlen(c);
		if(len==3&&c[0]=='E'&&c[1]=='O'&&c[2]=='F')break;
		q2++;
		for(int i=0;i<len;i++){
			if(c[i]=='<'&&!r.empty())r.pop();
			else if(c[i]!='\n')r.push(c[i]);
		}
		stack<char>x,y;
		while(!a[q2].empty()){
			x.push(a[q2].top());
			a[q2].pop();
		}
		while(!r.empty()){
			y.push(r.top());
			r.pop();
		}
		while(!x.empty()&&!y.empty()){
			if(x.top()==y.top())sum++;
			x.pop();
			y.pop();
		}
// 		cout<<sum<<endl;
		while(!x.empty())x.pop();
		while(!y.empty())y.pop();
	}
	t=read();
	ans=sum*60.0/t+0.5;
	cout<<ans;
	return 0;
}

2021/8/18 20:24
加载中...