Created
November 4, 2018 17:51
-
-
Save ateruimashin/dfd049b941a27cfd1acc06590abfba7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code have Compile Error.
fix:math.h→ cmath