- 毒瘤第四点,我调了差不多半小时了www
- 大佬帮忙调调,万分感谢
红题
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int n,last,h=1;
int t;
int v[7]={0,1,2,3,4,5,6},point=1;
bool flag=1;
int ans;
int main(){
cin>>n;
while(n--){
int now;
cin>>now;
if(now==1){
t++;
flag=0;
if(t>=(pow(2,last-1)) && last-1>=0 && h==0){
t-=pow(2,last-1);
last=0;
}
else if(t<(pow(2,last-1)) && h==0 && last-1>0){
t=0;
last=0;
}
if(t>=3&&t<7){
point=2;
}else if(t>=7&&t<30){
point=3;
}else if(t>=30&&t<120){
point=4;
}else if(t>=120&&t<365){
point=5;
}else if(t>=365){
point=6;
}else point=1;
ans+=v[point];
}else if(!flag){
last++;
}
h=now;
}
cout<<ans<<endl;
return 0;
}