社区讨论
捞
题目总版参与者 1已保存回复 0
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 0 条
- 当前快照
- 1 份
- 快照标识符
- @lwvivtuw
- 此快照首次捕获于
- 2024/06/01 10:57 2 年前
- 此快照最后确认于
- 2024/06/01 13:43 2 年前
C
#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;
}
回复
共 0 条回复,欢迎继续交流。
正在加载回复...