码迷,mamicode.com
首页 > 其他好文 > 详细

ARC017&&ABC058

时间:2017-04-10 21:11:58      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:term   gif   ons   memory   else   printf   stat   pac   c++   

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 }
View Code

ARC017&&ABC058

标签:term   gif   ons   memory   else   printf   stat   pac   c++   

原文地址:http://www.cnblogs.com/jianglingxin/p/6690889.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!