What was the mistake?
查看原帖
What was the mistake?
989399
louzezhong20130517楼主2023/6/24 18:50
#include<bits/stdc++.h>
using namespace std;
struct veh{
	char o;
	int one,two;
};
veh f[100001];
int main(){
	int n,i,sum,ticket=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>f[i].o>>f[i].one>>f[i].two;
	}
	for(i=1;i<=n;i++)
	{
		sum+=f[i].one;
		if(f[i].o=='0')
		{
			ticket+=1;
		}
		if(f[i].o=='1')
		{
			if(f[i-1].o=='0'&&f[i-1].one<=f[i].one&&f[i-1].two-f[i].two<45)
			{
				ticket-=1;
				sum-=f[i].one;
			}
		}
	}
	cout<<sum;
	return 0;
}
2023/6/24 18:50
加载中...