Skip to content

Latest commit

 

History

History
48 lines (38 loc) · 923 Bytes

File metadata and controls

48 lines (38 loc) · 923 Bytes

К оглавлению

Задача A. Сумма.

img.png


Решение

img_1.png


Код

import java.util.Scanner;

/**
* Задача А. Сумма.
  */
  public class Ex1 {

  public static void main(String[] args) {
  Scanner scr = new Scanner(System.in);
  int A = scr.nextInt();
  int B = scr.nextInt();
  int n = scr.nextInt();
  scr.close();

       int x = A - B;

       if (n > 0) {
           if ((x % 2 == 0) && (x >= 2 * n)) {
               System.out.println("YES");
           } else {
               System.out.println("NO");
           }
       } else if (n == 0) {
           if (A == B) {
               System.out.println("YES");
           } else {
               System.out.println("NO");
           }
       } else {
           System.out.println("NO");
       }
  }
  }