ログインしてください。
提出 #56510729
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
int main() {
int N,T,A;
cin >> N >> T >> A;
vector<int> H(N+1);
for(int i=1; i<=N; i++) cin >> H.at(i);
int minPos=1;
double minDiff = A - ((double)T - H.at(1) * 0.006);
// 単純に見えるがこのようにすべての可能性を全部計算して
// 求めるものはすべて全探索といえる.
for(int i=2; i<=N; i++) {
double diff = A - ((double)T - H.at(i) * 0.006);
if (abs(minDiff) > abs(diff)) {
minDiff = diff;
minPos = i;
}
}
cout << minPos << endl;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - Palace |
| ユーザ | strkgr |
| 言語 | C++ 20 (gcc 12.2) |
| 得点 | 200 |
| コード長 | 630 Byte |
| 結果 | AC |
| 実行時間 | 1 ms |
| メモリ | 3660 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 200 / 200 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample_01.txt, sample_02.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, sample_01.txt, sample_02.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 01.txt | AC | 1 ms | 3652 KiB |
| 02.txt | AC | 1 ms | 3564 KiB |
| 03.txt | AC | 1 ms | 3560 KiB |
| 04.txt | AC | 1 ms | 3660 KiB |
| 05.txt | AC | 1 ms | 3612 KiB |
| 06.txt | AC | 1 ms | 3624 KiB |
| 07.txt | AC | 1 ms | 3564 KiB |
| 08.txt | AC | 1 ms | 3492 KiB |
| 09.txt | AC | 1 ms | 3548 KiB |
| 10.txt | AC | 1 ms | 3556 KiB |
| sample_01.txt | AC | 1 ms | 3464 KiB |
| sample_02.txt | AC | 1 ms | 3560 KiB |