結果
問題 | No.2757 Pin Game |
ユーザー |
|
提出日時 | 2024-05-26 02:00:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 147 ms / 2,000 ms |
コード長 | 301 bytes |
コンパイル時間 | 1,812 ms |
コンパイル使用メモリ | 193,848 KB |
最終ジャッジ日時 | 2025-02-21 16:39:37 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 10 |
ソースコード
#include<bits/stdc++.h>using namespace std;using ll=long long;int main(){ll n,k;cin>>n>>k;vector<ll> x(n);for(ll i=0;i<n;i++){cin>>x[i];}ll ans=0;ll last=-1e15;for(ll i=0;i<n;i++){if(abs(x[i]-last)>=k){last=x[i];ans++;}}cout<<ans<<endl;}