#include<iostream>
using namespace std;
int main()
{
long long a,b,c;
cin>>a>>b>>c;
if(c==0)
{
if(a==b)
cout<<"YES";
else
cout<<"NO";
}
else
{
if((b-a)%c==0 and (b-a)/c>=0)
{
cout<<"YES";
}
else
{
cout<<"NO";
}
}
return 0;
}
#include<bits/stdc++.h> using namespace std; class graph { int v; list<int> *adj; public: graph(int v) { this->v=v; adj=new list<int>[v]; } void add_edge(int v,int w) { adj[v].push_back(w); } void dfs(int start); }; void graph:: dfs(int start) { bool *visited=new bool[v]; for(int i=0;i<v;i++) visited[i]=false; visited[start]=true; stack<int> s; s.push(start); while(!s.empty()) { int k=s.top(); s.pop(); ...
Comments
Post a Comment