版本比较
10.1综合测试总结
正文
增加 3 行删除 3 行
42 行未改动43444546474849505138 行未改动90919293949596979883 行未改动1821831841851861871881891904 行未改动42 行未改动```cpp#include<bits/stdc++.h>#define int long longusing namespace std;int t, x, y, ans;int read() {int r = 0, f = 1; char c = getchar();while ((c < '0' || c > '9') && (c ^ '-')) c = getchar();if (c == '-') f = -1, c = getchar();38 行未改动```cpp#include<bits/stdc++.h>#define int long longusing namespace std;int t, x, y, ans;int read() {int r = 0, f = 1; char c = getchar();while ((c < '0' || c > '9') && (c ^ '-')) c = getchar();if (c == '-') f = -1, c = getchar();83 行未改动int n, ans = 0; cin >> n;for (int i = 1; i <= n; i++) cin >> a[i];for (int i = 1; i <= n; i++) {for (int j = i + 2; j <= min(i + a[i], n); j++) num[j]++;if (num[i] >= a[i]) num[i + 1] += num[i] - (a[i] - 1);else if (num[i] < a[i]) ans += a[i] - 1 - num[i];}cout << ans << endl;4 行未改动42 行未改动43444546474849505138 行未改动90919293949596979883 行未改动1821831841851861871881891904 行未改动42 行未改动```cpp#include<bits/stdc++.h>#define int long longusing namespace std;int t, x, y, ans;int read() {int r = 0, f = 1; char c = getchar();while ((c < '0' || c > '9') && (c ^ '-')) c = getchar();if (c == '-') f = -1, c = getchar();38 行未改动```cpp#include<bits/stdc++.h>#define int long longusing namespace std;int t, x, y, ans;int read() {int r = 0, f = 1; char c = getchar();while ((c < '0' || c > '9') && (c ^ '-')) c = getchar();if (c == '-') f = -1, c = getchar();83 行未改动int n, ans = 0; cin >> n;for (int i = 1; i <= n; i++) cin >> a[i];for (int i = 1; i <= n; i++) {for (int j = i + 2; j <= min(i + a[i], n); j++) num[j]++;if (num[i] >= a[i]) num[i + 1] += num[i] - (a[i] - 1);else if (num[i] < a[i]) ans += a[i] - 1 - num[i];}cout << ans << endl;4 行未改动