社区讨论
小学生的60分
P1664每日打卡心情好参与者 3已保存回复 13
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 13 条
- 当前快照
- 1 份
- 快照标识符
- @miohv8qc
- 此快照首次捕获于
- 2025/12/02 19:28 3 个月前
- 此快照最后确认于
- 2025/12/08 04:23 2 个月前
CPP
#include<bits/stdc++.h>
using namespace std;
int n,a[1003],cnt,sum,s;
int check(int x){
if(x==0) return 0;
else if(x<3) return 1;
else if(x<7) return 2;
else if(x<30) return 3;
else if(x<120) return 4;
else if(x<365) return 5;
else return 6;
}
int main(){
cin>>n;
for(int i=1;i<=n;i++){
int t;
cin>>t;
if(t==1){
cnt++;
if(sum>0){
cnt-=1*pow(2,sum-1);
if(cnt<0) cnt=0;
sum=0;
}
s+=check(cnt);
}
else if(i>1) sum++;
}
cout<<s<<endl;
return 0;
}
我才是个小学生,能不能给我看一下(60分)
改完必关!!
回复
共 13 条回复,欢迎继续交流。
正在加载回复...