int main() { std::vector<int> test {-2,0,3,-5,2,-1}; NumArray numArray(test); printf("here %d %d %d %d\n", test.size(), numArray.leftIdx, numArray.rightIdx, numArray.sum); printf("%d\n", numArray.sumRange(0,2)); printf("%d\n", numArray.sumRange(2,5)); printf("%d\n", numArray.sumRange(0,5)); }
int main() { int arr[] = {1,2, 3}; vector<int> v(arr, arr+sizeof(arr)/sizeof(int)); NumArray numArray(v); std::cout << numArray.sumRange(0, 1) << std::endl; std::cout << numArray.sumRange(1, 2) << std::endl; return 0; }
int main(){ int A,B,C; scanf("%d %d", &A, &B); C = A + B; numArray(C,num); if(C < 0){ printf("-"); } for(int i = index -1; i >= 0; --i){ if(num[i] == -1){ if(i != index -1){ printf(","); } }else{ printf("%d",num[i]); } } return 0; }