JollyJumpers/조현태 (rev. 1.1)
Code ¶
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace JollyJumpers
{
class Program
{
static void Main(string[] args)
{
String text = System.Console.ReadLine();
while (null != text && 0 != text.Length)
{
bool isJollyJumpers = true;
String[] textNums = text.Split(' ');
int[] nums = new int[textNums.Length];
for (int i = 0; i < nums.Length; ++i)
{
nums[i] = int.Parse(textNums[i]);
}
if (0 == nums[0])
{
return;
}
for (int i = 1; i < nums.Length - 1; ++i)
{
if (nums[0] <= Math.Abs(nums[i] - nums[i + 1]))
{
isJollyJumpers = false;
break;
}
}
if (isJollyJumpers)
{
System.Console.WriteLine("Jolly");
}
else
{
System.Console.WriteLine("Not jolly");
}
text = System.Console.ReadLine();
}
}
}
}