Thread: Problem with task

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jan 2013
    Posts
    3

    Problem with task

    Hi, I have a problem with my task. I have 2-dimensional board and in the middle are 3 numbers (1,1,1) - in vertical rotation. They make one segment. The „next step” will be one distinction of that segment. It is growing in the way that to each end, added are the next numbers (one greater than the previously added) with changing rotation (vertical- horizontal -vertical etc.)
    On that 2-dimensional board I put point (x,y) in some place, which in case of meeting with growing segments will stop their growth. My job is to put for giving points (x,y) if growing segments
    will ever meet with the points (if yes after how many steps ),if not then I have to write never.

    I think I need to look for solution in moving diagonal. For main diagonal (0x0, 1x1, 2x2 etc.) Results are next power of number 2. Every next power of the number 2 they make ,,almost squares" with dimensions (2^¡)- 1 x 2^¡. At the end of that squares ( in middle of the bigger square) (1x2,3x4,7x8 etc.)....(each smaller is a half of the bigger one )) I am able to turn in any another diagonal and in her middle I am able to turn in another one (just how many times I need), but unfortunately there are a certain shifts (resulting probably from that the ,,almost squares" are not the real squares (3x4 instead of 4x4)). I m going to show it in the examples below for better understanding. I am adding also a link to the picture of the board (32x32) and few examples correct and invalid.
    Board (-1- will never meet, 0x0 in the bottom left corner): img27.imageshack.us/img27/3600/planszad.png

    Example 1. (Correct)
    1). Preliminary result: 8 (4x4)
    2). Preliminary result: 12 (6x2)
    3). Preliminary result: 10 (5x3) (half dimensional of quadrangle 4x4 6x2)
    4). End result: 12 (4x2)

    Example 2 (correct)
    x =2 y=10
    1) preliminary result: 16 (8x8)
    2) preliminary result: 24 (4x12)
    4) end result: 28 (2x10)

    Example 3 (invalid)
    X=9. Y=3 (the result is number even and is placed UNDER dimensional)
    1) preliminary result: 16 (8x8)
    2) preliminary result: 24 (12x4)
    Preliminary result: 28 (10x2)
    4) end result: 30 (9x3)

    Explanation: in the end result the result should be reduced by 2 not increased but I don't know what I am doing wrong. Please help me with this task, I need to finish it till the end of the week.

    P.S. Coordinates x and y they fit in interval (-100000;100000) but growing segments are ,,quarters" symmetric so in case of negative coordinates we can make them into positive (x=|x|, y=|y|). I put a link to oryginal content of the task: img51.imageshack.us/img51/462/tresc.png
    Last edited by Salem; 01-10-2013 at 09:07 AM. Reason: Fixed image URLs

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help from the task
    By MAJA83 in forum C Programming
    Replies: 1
    Last Post: 06-06-2012, 11:35 AM
  2. Need help to do the big task
    By Steve Cao in forum Linux Programming
    Replies: 1
    Last Post: 07-16-2010, 02:01 PM
  3. Replies: 2
    Last Post: 12-31-2007, 11:40 AM
  4. Task/Process Problem
    By slx47 in forum C++ Programming
    Replies: 1
    Last Post: 05-11-2002, 05:37 AM
  5. task bar
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 03-21-2002, 05:53 PM