Codechef : Problem name "Enough Space" solution in C#

 ============================Solution=========================

using System;


public class Test

{

public static void Main()

{

    int t=Convert.ToInt32(Console.ReadLine());

for(int i=0;i<t;i++){

    string[] array=Console.ReadLine().Split(' ');

    int N=Convert.ToInt32(array[0]);

    int X=Convert.ToInt32(array[1]);

    int Y=Convert.ToInt32(array[2]);

    if(X+(2*Y)<=N){

        Console.WriteLine("YES");

    }

    else

    Console.WriteLine("NO");

}

}

}

===========================Explanation=============================

Chef has total space of N GB left, he is trying to put X files of 1GB and Y files of 2GB
So if sum of the space covered by X and Y files exceeded the N , chef cannot put those files.

Comments