垃圾题目
class Solution { public: int sum(string str) { long long ret = 0; int len = str.length(); int flag = 0; for(int i = 0; i < len; i++) { if(str[len - i - 1] == '1') { flag++; } ret += (long long)((str[len - i - 1] - '0') * pow(2, i)); } if(flag == 32) return -1; return ret; } vector<int> drawLine(int length, int w, int x1, int x2, int y) { vector<int> v; x1 = y * w + x1, x2 = y * w + x2; for(int i = 0; i < length; i++) { string str = ""; for(int j = 0; j < 32; j++) if(x1 <= i * 32 + j && i * 32 + j <= x2) str += '1'; else str += '0'; v.push_back(sum(str)); } return v; } };