Codeforces Pineapple Incident
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#define sf scanf
#define pf printf
#define high 1000000000
using namespace std;
typedef long long LL;
int main()
{
LL t, s, x;
while(~sf("%lld %lld %lld", &t, &s, &x))
{
// equation: t + (s * y) = x;
LL sub = abs(x - t);
LL y = sub / s;
LL ans = t + (s * y);
if(ans == x)
{
pf("YES\n");
}
else
{
if(y!=0)
{
ans++;
}
if(ans == x)
{
pf("YES\n");
}
else
{
pf("NO\n");
}
}
}
return 0;
}
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#define sf scanf
#define pf printf
#define high 1000000000
using namespace std;
typedef long long LL;
int main()
{
LL t, s, x;
while(~sf("%lld %lld %lld", &t, &s, &x))
{
// equation: t + (s * y) = x;
LL sub = abs(x - t);
LL y = sub / s;
LL ans = t + (s * y);
if(ans == x)
{
pf("YES\n");
}
else
{
if(y!=0)
{
ans++;
}
if(ans == x)
{
pf("YES\n");
}
else
{
pf("NO\n");
}
}
}
return 0;
}
Comments
Post a Comment