U E D R , A S I H C RSS

Jolly Jumpers/조현태

JollyJumpers/조현태


  • 이렇게 짜면 안됀다는걸 잘 보여주는 예.

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();
            }
        }
    }
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:35
Processing time 0.0154 sec