Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lamentamos que algo salió mal. ¿Qué pasó?

book
Equal Coins Distribution

Bob has three sisters: Ann, Bella, and Caroline. They're collecting coins. Currently, Ann has a coins, Bella has b coins and Caroline has c coins. Recently Bob has returned from the trip around the world and brought n coins.

He wants to distribute all these n coins between his sisters in such a way that the number of coins Ann has is equal to the number of coins Bella has and is equal to the number of coins Caroline has. In other words, if Bob gives A coins to Ann, B coins to Bella and C coins to Caroline A+B+C=n, then a+A=b+B=c+C

Note that A, B or C (the number of coins Bob gives to Ann, Bella and Caroline correspondingly) can be 0. Help Bob to find out if it is possible to distribute all n coins between sisters in a way described above.

Given an integers a - the number of coins Ann has , b - number of coins Bella has, c - number of coins Caroline has and n - the number of coins Bob has. Return YES if Bob can distribute all n coins between his sisters and NO in the opposite case.

Example 1

Input:

a = 3, b = 798, c = 437, n = 1804

Output:

YES
main.cpp

main.cpp

cpp

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

some-alt