Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: need help to solve the problem

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default need help to solve the problem

    hi
    is there any one who can give me the complete solution in java.

    1 Answer
    Dr. Alberquert invented the
    following three devices to set
    up a simple communication
    network:
    Synthesizer (S), which
    produces signals continuously
    and transmits (propagates /
    passes on) them to
    neighbouring cells but cannot
    receive signals.
    Receiver (R), which can receive
    signals from neighbouring
    signal sources but cannot
    produce or propagate signal.
    Transmitter (T), which is
    capable of both receiving
    signal from and transmitting
    signals to neighbouring cells.
    Transmitters also are NOT
    capable of producing signals.
    These devices are laid in a
    matrix formation. Signals are
    propagated at the rate of one
    cell per time unit. The
    absorption rate of a receiver is
    unlimited and so also the
    transmission and absorption
    rate of a transmitter unlimited.
    For simplicity we shall ignore
    the exact nature of signals
    being produced and consider
    them uniform across sources.
    Devices on the extreme right
    side can also communicate
    with the extreme left hand
    side device present in the
    same row (see fig 2). Similarly
    a device on the extreme top
    can also communicate with a
    device at the extreme bottom
    if they are present in the same
    column.
    Please Note:
    Neighbourhood is a four cell
    neighbourhood, i.e, the
    neighbourhood of a cell is
    defined by cells to its NORTH,
    SOUTH, EAST and WEST (see fig
    1).
    All Synthesizers will start to
    produce signals as soon as the
    simulation begins.
    There could be multiple
    Synthesizers in a matrix
    arrangement.
    Your task is to write a
    program that would take a
    matrix containing devices and
    output the time at which each
    receiver/transmitter receives
    its first signal.
    Input specification:
    The first line has two integers
    M and N indicating the number
    of rows and columns of the
    matrix. 0 < M, N <= 20
    M lines follow the first line.
    Each of these M lines contains
    N characters and a terminating
    new line. Each character is one
    of S, T or R.
    Output specification:
    The output should be a matrix
    of M rows with each row
    containing N integers
    separated by spaces indicating
    the minimum time required for
    the signal to reach the
    corresponding device. The
    output for cells containing
    Synthesizers is 0. For devices
    that never receive any signal,
    print -1.
    Sample Input and Output:
    Input:
    3 4
    SRTR
    TTTT
    TTTS
    Output:
    0 1 3 1
    1 2 2 1
    1 2 1 0
    Input:
    2 3
    RTT
    TTR
    Output:
    -1 -1 -1
    -1 -1 -1


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: need help to solve the problem

    Welcome to the forums. Please read this: http://www.javaprogrammingforums.com...e-posting.html

    This forum is not for asking questions, which is fine, because you haven't asked a question. You can't just dump your homework here. Please read the link in my signature on asking questions the smart way, then post a specific question in the appropriate forum.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Please help me solve this problem, this is really urgent!
    By KalvinL7 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 1st, 2012, 02:55 PM
  2. help me to solve my problem
    By miszIna in forum Object Oriented Programming
    Replies: 3
    Last Post: February 14th, 2011, 09:40 AM
  3. Plz solve the problem
    By rasheedmgs in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: October 14th, 2010, 11:59 AM
  4. Questions about a Problem I'm trying to solve
    By DarkEssence in forum Java Theory & Questions
    Replies: 4
    Last Post: March 17th, 2010, 06:29 AM
  5. Replies: 3
    Last Post: June 14th, 2009, 09:31 PM