-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodecleanups.cc
More file actions
55 lines (50 loc) · 879 Bytes
/
Copy pathcodecleanups.cc
File metadata and controls
55 lines (50 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//C
//not complete
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
#define INF 1000000000
int main() {
int n;
cin >> n;
vector<int> days(n);
int ans = 0;
for(int i=0; i<n;i++) {
cin >> days[i];
}
//cout << "ans: " << ans << " last: " << last << " temp: " << temp << endl;
int last = -1;
int dirty = 0;
for(int i=0; i<n; i++) {
int temp = days[i];
//just cleaned or start
if(last == -1) {
last = i;
dirty = 0;
}
else {
for(int j=last; j<i;j++) {
dirty += temp - days[j];
}
}
if(dirty > 19) {
ans++;
last = i;
dirty = 0;
}
}
// else if(temp - last > 19) {
// ans++;
// last = temp;
// }
// else {
// ans++;
// last = 0;
// }
if(last != -1) {
ans++;
}
cout << ans;
return 0;
}