Monday, August 28, 2017

2143 The Return of Radar Uri Problem Only Solution In C#


https://www.urionlinejudge.com.br/judge/en/problems/view/2143



using System; 

 class Exercise8


   
    static int max(int a, int b)
    
  {
    return ((a>b) ? a: b);
  }
       
     static void Main()
    
    {
       
    while(true)
    {
         int tst=Convert.ToInt32(Console.ReadLine());
         if(tst==0)
         {
             break;
         }
        for(int i=1; i<=tst; i++)
        {
            int n=Convert.ToInt32(Console.ReadLine());
            if(n%2!=0) Console.WriteLine( n*2-1);
            else Console.WriteLine(n*2-2);
        }
    }
    }
   
}

No comments:

Post a Comment