第21783题 单选题
每次仅可将数组元素加1,计算将数组变为非递减所需最少操作次数的C++代码空缺处应填入哪一项?
#include<iostream>
usingnamespace std;
int a[1000];int main(){
int n, cnt = 0;
cin >> n;
for (inti= 0; i<n; i++) cin >> ali];
for (int i= 1;i< n; i++){
if (a[i - 1]> a[i]) {
cnt += ① ;
②_;
}
}
cout << cnt;
return 0;
}
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析