結果
問題 |
No.2091 Shio Ramen (Easy)
|
ユーザー |
👑 |
提出日時 | 2022-10-06 22:45:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 432 bytes |
コンパイル時間 | 487 ms |
コンパイル使用メモリ | 66,856 KB |
最終ジャッジ日時 | 2025-02-07 22:22:31 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
#include <iostream> using namespace std; int main(){ int n,m,k;cin>>n>>m>>k; int dist = k+1; int ans = -1; for(int i = 0; n > i; i++){ int x;cin>>x; if(m-k <= x && x <= m+k){ if(dist > abs(x-m)){ dist = abs(x-m); ans = i+1; } } } if(ans == -1){ cout << "Unlucky!" << endl; }else{ cout << ans << endl; } }