Блог пользователя redgulli

Автор redgulli, история, 3 года назад, По-английски

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.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится