redgulli's blog

By redgulli, history, 3 years ago, In English

I have applied the following logic for the problem https://codeforces.com/contest/799/problem/A

#include<iostream>
using namespace std;
int main(){
	double N, T, K, D;
	cin>>N>>T>>K>>D;
	double x=(D*K)/T;
	double a=D+((N-x)*T)/(2*K);
	double b=(N*T)/K;
	if(a<b)
	cout<<"YES";
	else
	cout<<"NO";
	cout<<endl;
}

I saw a solution here which used int instead of double and some modulo arithmetic. My solution is producing wrong answer in some cases. But the underlying logic seems to be the same. How to approach this problem then ?

Please help.

Thanks.

  • Vote: I like it
  • 0
  • Vote: I do not like it