Monday, August 28, 2017

DCP-33: Catch Me If You Can Devskill Problem Only Solution In C#

https://www.devskill.com/CodingProblems/ViewProblem/33



using System; 

 public class Exercise8 


     public static void Main()
   
     {
        int k=Convert.ToInt32(Console.ReadLine());
       
        for(int p=1;p<=k;p++){
            string s=Console.ReadLine();
            string[] values=s.Split(' ');
            int a=int.Parse(values[0]);
            int b=int.Parse(values[1]);
            int c=int.Parse(values[2]);
            int d=int.Parse(values[3]);
            int e=a*d;
            int f=(b*d)+c;
            if(f<e || (c==0 && d>0))
                Console.WriteLine("Case "+p+": Abir will be arrested");
            else
                Console.WriteLine("Case "+p+": Abir will survive");
        }
     }

}

No comments:

Post a Comment