Algorithm
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, s, x;
scanf("%d %d %d", &t, &s, &x);
if(x >= t && (t - x) % s == 0) {
puts("YES");
return 0;
}
--x;
if(x > t && (t - x) % s == 0) {
puts("YES");
return 0;
}
puts("NO");
return 0;
}
Copy The Code &
Try With Live Editor
Input
3 10 4
Output
NO
Demonstration
Codeforces Solution-Pineapple Incident-Solution in C, C++, Java, Python