Advertisement
rotti321

A - Tiny Arithmetic Sequence

May 19th, 2021
1,230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int a,b,c,x;
  7.     cin>>a>>b>>c;
  8.     if(a>b){
  9.        // swap(a,b);
  10.         x=a;
  11.         a=b;
  12.         b=x;
  13.     }
  14.    if(b>c){
  15.        x=b;
  16.        b=c;
  17.        c=x;
  18.    }
  19.        if(a>b){
  20.         x=a;
  21.         a=b;
  22.         b=x;
  23.     }
  24.    if(b-a==c-b){
  25.        cout<<"Yes";
  26.    }
  27.    else
  28.    cout<<"No";
  29.  
  30.  return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement