每日一更4.12

每日一更4.12

_

今天不更新小游戏了,给c++友们推荐一个周赛
https://www.oi-union.com/
非常难

#include <iostrehttps://www.oi-union.com/am> #include <algorithm> using namespace std; int r, n, x[1005]; int main() { cin >> r >> n; for (int i = 1; i <= n; i++) cin >> x[i]; sort(x + 1, x + n + 1); int last = -1005, ans = 0; for (int i = 1; i <= n; i++) { if (last + r < x[i]) { for (int j = i; j <= n; j++) { if (x[j] <= x[i] + r) last = x[j]; } ans++; } } cout << ans << endl; return 0; }

weisha 2026-04-12
猜数字小游戏(扣子做的) 2026-04-12

评论区