675A Codeforces - Infinite Sequence


675A Codeforces




Solution in c++

#include <bits/stdc++.h>
using namespace std;

long long int a,b,c;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>a>>b>>c;b-=a;
    if( (b==0) || (c!=0 && b%c==0) && ( (b>=0 && c>=0)||(b<=0 && c<=0)) )cout<<"YES";
    else cout<<"NO";
}
Share on Google Plus

About Mohamed Sobhi

My name is Mo.Sobhy ,I study at School excelling high school in Ain Shams ,Cairo
My hobbies is programming ,and web development ,playing chess and writing horror stories.
    Blogger Comment
    Facebook Comment

0 التعليقات:

إرسال تعليق