This commit is contained in:
youngyangyang04
2020-12-06 23:13:01 +08:00
parent 5a6d2c001c
commit b71eb438bc
2 changed files with 2 additions and 1 deletions

View File

@ -70,7 +70,7 @@ public:
K--;
}
}
while (K--) A[A.size() - 1] *= -1; // 第三步
if (K % 2 == 1) A[A.size() - 1] *= -1; // 第三步
int result = 0;
for (int a : A) result += a; // 第四步
return result;