結果
問題 |
No.2757 Pin Game
|
ユーザー |
![]() |
提出日時 | 2024-05-17 21:21:10 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 455 bytes |
コンパイル時間 | 1,983 ms |
コンパイル使用メモリ | 194,652 KB |
最終ジャッジ日時 | 2025-02-21 14:25:15 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main() { fast_io(); int n, k; cin >> n >> k; vector<int> x(n); for (int i = 0; i < n; i++) { cin >> x[i]; } int cur = x[0] - k, ans = 0; for (int i = 0; i < n; i++) { if (x[i] - cur >= k) { ans++; cur = x[i]; } } cout << ans << endl; }