Codechef : Problem name " Car Trip " 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 X=Convert.ToInt32(Console.ReadLine());

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

    if(X>300){

        Console.WriteLine(X*10);//10*300 + (X-300)*10);

    }

    else if(X<=300)

    Console.WriteLine(3000);

}

}

}

=======================Explanation======================
Its says it charges 10 rupees per km
if rented for the day then even not driven for 300 km we have to pay for 300 km
else we need to pay for extra km after 300 km

Comments