ARC017&&ABC058

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 }
View Code

以上是关于ARC017&&ABC058的主要内容,如果未能解决你的问题,请参考以下文章

Digit Sum II(ABC044&ARC060)

Qt&Vtk-017-EasyView

Solution -「ARC 058C」「AT 1975」Iroha and Haiku

ARC058 D - Iroha and a Grid(思维,组合数学)

ARC 058D いろはちゃんとマス目 组合数学

为啥 Mutex 被设计为需要 Rust 中的 Arc