結果
問題 | No.2091 Shio Ramen (Easy) |
ユーザー |
|
提出日時 | 2025-02-12 20:12:39 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 437 bytes |
コンパイル時間 | 891 ms |
コンパイル使用メモリ | 97,504 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-02-12 20:12:41 |
合計ジャッジ時間 | 1,621 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
#include <iostream>#include <cstdint>#include <cmath>using namespace std;int main(){cin.tie(nullptr);ios::sync_with_stdio(false);int32_t N, S, K, i;cin >> N >> S >> K;static int32_t A[10];for (i = 0; i != N; ++i) cin >> A[i];uint32_t ans = 0;for (i = 0; i != N; ++i)if (abs(A[ans] - S) > abs(A[i] - S))ans = i;if (abs(A[ans] - S) > K) cout << "Unlucky!\n";else cout << ans + 1 << '\n';return 0;}