ARC017&&ABC058

A - ι⊥l(无敌水题)

Time limit : 2sec / Memory limit : 256MB

Score : 100 points

Problem Statement

Three poles stand evenly spaced along a line. Their heights are ab and c meters, from left to right. We will call the arrangement of the poles beautiful if the tops of the poles lie on the same line, that is, ba=cb.

Determine whether the arrangement of the poles is beautiful.

Constraints

  • 1≤a,b,c≤100
  • ab and c are integers

Input

Input is given from Standard Input in the following format:

a b c

Output

Print YES if the arrangement of the poles is beautiful; print NO otherwise.

Sample Input 1

2 4 6

Sample Output 1

YES

Since 4−2=6−4, this arrangement of poles is beautiful.

Sample Input 2

2 5 6

Sample Output 2

NO

Since 5−2≠6−5, this arrangement of poles is not beautiful

Sample Input 3

3 2 1

Sample Output 3

YES

Since 1−2=2−3, this arrangement of poles is beautiful.

Means:

就让你判断b - a 是否等于 c - b

Solve:

超级水题

Code:

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 int main()
 4 {
 5     int a , b , c;
 6     scanf("%d%d%d" , &a , &b , &c);
 7     if(b - a == c - b)
 8         printf("YES\n");
 9     else
10         printf("NO\n");
11 }

时间: 2024-10-13 22:44:03

ARC017&&ABC058的相关文章