forked from Request2609/codeOfPractice
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.cpp
More file actions
51 lines (46 loc) · 972 Bytes
/
Copy patharray.cpp
File metadata and controls
51 lines (46 loc) · 972 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
#include <iostream>
#include <vector>
using namespace std ;
class Solution {
public:
vector<bool> prefixesDivBy5(vector<int>& A) {
vector<bool>tmp ;
int len = A.size() ;
int sum = 0 ;
int count = 0 ;
for(int i=0; i<len; i++) {
count = 0 ;
sum+=sum*2+A[i] ;
sum%=5 ;
if(sum) {
cout << "false" << endl ;
tmp.push_back(false) ;
}
else {
cout << "true" << endl ;
tmp.push_back(true) ;
}
}
return tmp ;
}
int getPow(int len) {
int num = 1 ;
for(int i=0; i<len; i++) {
num*=2 ;
}
return num ;
}
};
int main()
{
Solution ss ;
vector<int>ls ;
while(1) {
int a ;
cin >> a ;
if(a == -1) break ;
ls.push_back(a) ;
}
ss.prefixesDivBy5(ls) ;
return 0;
}