結果

問題 No.2091 Shio Ramen (Easy)
ユーザー yansi819
提出日時 2024-03-20 09:58:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 454 bytes
コンパイル時間 4,193 ms
コンパイル使用メモリ 251,036 KB
最終ジャッジ日時 2025-02-20 08:01:11
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;

int N, S, K, M = 1e9, ans = -1;
int A[11];
int main() {
  cin >> N >> S >> K;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
    if (abs(A[i] - S) <= K) {
      if (M > abs(A[i] - S)) {
        M = abs(A[i] - S);
        ans = i;
      }
    }
  }
  if (ans == -1) cout << "Unlucky!" << endl;
  else cout << ans << endl;
  return 0;
}
0