个位为0或5
class Solution {
public:
vector<bool> prefixesDivBy5(vector<int>& A) {
int cur = 0;
vector<bool> res(A.size());
for(int i=0; i<A.size(); i++){
cur = ((cur<<1) | A[i]) % 5;
res[i] = (cur == 0);
}
return res;
}
};
2010/01/14
原文:https://www.cnblogs.com/vwmin/p/14276069.html