Need Help in solving 799A. Carrots

Правка en1, от redgulli, 2020-11-30 05:07:24

I have applied the following logic for the problem https://codeforces.me/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.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский redgulli 2020-11-30 05:07:24 712 Initial revision (published)