Skip to content

Instantly share code, notes, and snippets.

@ateruimashin
Created November 4, 2018 17:51
Show Gist options
  • Save ateruimashin/dfd049b941a27cfd1acc06590abfba7d to your computer and use it in GitHub Desktop.
Save ateruimashin/dfd049b941a27cfd1acc06590abfba7d to your computer and use it in GitHub Desktop.
#include <iostream>
#include <math.h>
using namespace std;
int main(int argc, char const *argv[]) {
int n;
double t,a;
cin>>n>>t>>a;
double h,tem,min,ans;
for(int i=1;i<=n;i++){
cin>>h;
if(i==1){
min=abs(a-(t-h*0.006));
ans=1;
}else{
tem=abs(a-(t-h*0.006));
if(tem<min){
min=tem;
ans=i;
}
}
}
cout<<ans<<endl;
return 0;
}
@ateruimashin
Copy link
Author

This code have Compile Error.
fix:math.h→ cmath

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment