捞
查看原帖
捞
833856
BossEducation楼主2024/6/1 10:55

传送门

20%WA

#include<iostream>
using namespace std;
int v[7];
bool ni[1000000];
int main()
{
	int n,count=1,total=0;
	cin>>n;
	for(int i=1;i<=6;i++)
	{
		cin>>v[i];
	}
	for(int i=1;i<=n;i++)
	{
		cin>>ni[i];
	}
	for(int i=1;i<=n;i++)
	{
		if(ni[i]==1)
		{
			if(count<=2)
			{
				total+=v[1];
				count++;
			}
			else if(count>2&&count<=7)
			{
				total+=v[2];
				count++;
			}
			else if(count>7&&count<=30)
			{
				total+=v[3];
				count++;
			}
			else if(count>30&&count<=120)
			{
				total+=v[4];
				count++;
			}
			else if(count>120&&count<=365)
			{
				total+=v[5];
				count++;
			}
			else
			{
				total+=v[6];
				count++;
			}
		}
		else
		{
			count=0;
		}
	}
	cout<<total;
}
2024/6/1 10:55
加载中...