ham kiem tra

mail@pastecode.io avatar
unknown
plain_text
a year ago
278 B
0
Indexable
Never
bool is_ok(){
	int sum = 0, num = 0, sign = 1;
	for(int i = 0; i < 2*n - 1; i++){
		if(i % 2 == 0){
			num = num*10 + arr[i];
		}
		else{
			if(arr[i] == 0) {continue;}
			sum += num*sign;
			num = 0;
			sign = arr[i];
		}
	}
	sum += num*sign;
	return sum == 0;
}