結果
問題 | No.2091 Shio Ramen (Easy) |
ユーザー |
![]() |
提出日時 | 2023-04-19 20:22:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 675 bytes |
コンパイル時間 | 1,674 ms |
コンパイル使用メモリ | 166,756 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-14 22:46:16 |
合計ジャッジ時間 | 2,724 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i = 0;i<n;i++)#define all(x) x.begin(),x.end()#define yesif(x) cout << ((x) ? "Yes": "No") << endl#define myceil(a, b) (a+b-1)/busing namespace std;typedef long long ll;int main() {int n, s, k; cin >> n >> s >> k;int min_diff = 10;int answer = -1 ;rep(i, n){int a; cin >> a;int diff = abs(a - s);if( diff <= k){if(min_diff > diff){min_diff = diff;answer = i+1;}}}if(answer == -1){cout << "Unlucky!" << endl;} else {cout << answer << endl;}return 0;}