結果
問題 |
No.2091 Shio Ramen (Easy)
|
ユーザー |
![]() |
提出日時 | 2022-10-07 17:40:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 598 bytes |
コンパイル時間 | 255 ms |
コンパイル使用メモリ | 41,600 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-30 02:10:07 |
合計ジャッジ時間 | 848 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
/* -*- coding: utf-8 -*- * * 2091.cc: No.2091 Shio Ramen (Easy) - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ const int MAX_N = 10; /* typedef */ /* global variables */ int as[MAX_N]; /* subroutines */ /* main */ int main() { int n, s, k; scanf("%d%d%d", &n, &s, &k); for (int i = 0; i < n; i++) scanf("%d", as + i); int mind = k + 1, mini = -1; for (int i = 0; i < n; i++) { int d = abs(s - as[i]); if (mind > d) mind = d, mini = i; } if (mini >= 0) printf("%d\n", mini + 1); else puts("Unlucky!"); return 0; }