- 毒瘤第四点,我调了差不多半小时了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;//flag是个小处理,从第一次开始遇到1开始算
//cout<<"h"<<" "<<h<<endl;
// cout<<"nlast"<<last<<endl;
//flag=0;
if(t>=(pow(2,last-1)) && last-1>=0 && h==0){
//cout<<"ok"<<endl;
t-=pow(2,last-1);
last=0;
}//
else if(t<(pow(2,last-1)) && h==0 && last-1>0){
t=0;
last=0;
}//小特判,超过已打卡天数直接归零
//cout<<"nt:"<<t<<endl;
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++;//计算缺少天数
//flag=1;
}
//t-=pow(2,last-1);
//cout<<"nt:"<<t<<endl;
// 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;
//cout<<t<<' '<<ans<<" "<<v[point]<<endl;
h=now;//记录上一天是否打卡
}
cout<<ans<<endl;
return 0;
}