Problem:
Score : 100 points

Problem Statement

Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1.

Constraints

1\leq N,K\leq 100

N and K are integers.

Input

Input is given from Standard Input in the following format:

N K

Output

If we can choose K integers as above, print YES; otherwise, print NO.

Sample Input 1

3 2

Sample Output 1

YES

We can choose 1 and 3.

Sample Input 2

5 5

Sample Output 2

NO

Sample Input 3

31 10

Sample Output 3

YES

Sample Input 4

10 90

Sample Output 4

NO

Solution in C (GCC 5.4.1) (judge verdict: Wrong Answer)


#include <stdio.h>
#include <stdlib.h>

int main() {
    int *ip = 0;
    int N = 0;
    int K = 0;
    char flag = 0;
    scanf("%d%d",&N,&K);
    
    ip = (int *)malloc(N * sizeof(int));
    
    for(int i = 0; i < N; i++)
    {
        ip[i] = i+1;
        if(ip[i] != N-1 && ip[i] > K)
        {
            flag = 1;
        }
    }
    
    
    
    if(flag)
    {
        printf("YES");
    }
    else
    {
        printf("NO");
    }
    return 0;
}