You are viewing a single comment's thread. Return to all comments →
here is my o(n) code but still some test cases are failing
using namespace std; int main() { int n; cin>>n; long double max=0; for( int x=1; x<n-1; x++) { if(n>=3) { long double f=2*sin(x)+sin(n-2*x); if(f>max) max=f; else max; } } cout.setf(ios::fixed); cout << setprecision(9) << max << endl; return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Hard Homework
You are viewing a single comment's thread. Return to all comments →
here is my o(n) code but still some test cases are failing