0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2025-01-11 18:31:58 +00:00

P1664 每日打卡心情好

R41363285
This commit is contained in:
Baoshuo Ren 2020-11-06 09:36:49 +08:00 committed by Baoshuo Ren
parent 162d089d41
commit 4477dab230
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

42
problem/P1664/P1664.cpp Normal file
View File

@ -0,0 +1,42 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, d = 0, ans = 0, m = 0, now;
cin >> n;
while (n--) {
cin >> now;
if (now) {
if (m > 0) {
d -= pow(2, m - 1);
}
if (d < 0) {
d = 0;
}
ans++;
d++;
m = 0;
if (d >= 3) {
ans++;
}
if (d >= 7) {
ans++;
}
if (d >= 30) {
ans++;
}
if (d >= 120) {
ans++;
}
if (d >= 365) {
ans++;
}
}
else {
m++;
}
}
cout << ans << endl;
return 0;
}