#做完网易2023秋招笔试题,我裂开了##网易笔试# 我不太明白第二题为啥这么写不对。思路就是分奇偶位统计出各自的最大值,然后分奇偶位看一下加到这个最大值需要多少。如果奇偶位的最大值相同,那么有一半需要再全部+1```c++#include using namespace std;int main() { int n; long long num; vector nums; long long oddMax=-1, evenMax = -1; while (cin >> n) { int res = 0; nums = vector(n, 0); for (int i = 0; i cin >> num; nums[i] = num; if (i%2 == 0) evenMax = evenMax > num ? evenMax : num; else oddMax = oddMax > num ? oddMax : num; } for (int i = 0; i if (i%2 == 0) { res += (evenMax-nums[i]); } else { res += (oddMax - nums[i]); } } if (evenMax == oddMax) res += (n/2); cout }}```