Submission #3533328


Source Code Expand

Copy
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(void) {
  int N, T, A;
  vector<int> H;
  cin >> N >> T >> A;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    H.push_back(tmp);
  }

  int ans = 0;
  double minimum = abs(0.006 * H[0] + A - T);

  for (int i = 1; i < N; i++) {
    double tmp = abs(0.006 * H[i] + A - T);
    if (tmp < minimum) {
      ans = i;
      minimum = tmp;
    }
  }

  cout << (ans + 1) << endl;

  return 0;
}

Submission Info

Submission Time
Task B - Palace
User set0gut1
Language C++14 (GCC 5.4.1)
Score 200
Code Size 522 Byte
Status
Exec Time 1 ms
Memory 256 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt
All 200 / 200 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
Case Name Status Exec Time Memory
01.txt 1 ms 256 KB
02.txt 1 ms 256 KB
03.txt 1 ms 256 KB
04.txt 1 ms 256 KB
05.txt 1 ms 256 KB
06.txt 1 ms 256 KB
07.txt 1 ms 256 KB
08.txt 1 ms 256 KB
09.txt 1 ms 256 KB
10.txt 1 ms 256 KB
sample_01.txt 1 ms 256 KB
sample_02.txt 1 ms 256 KB