Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: i don't get it

  1. #1
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    i don't get it

    Can someone help me about this task?

    The year is 2055. Little Z is now full grown man, and works in a successful programmers company called "Rainyday". One day when he came home, he found his little son Z with dominos. Z needed some time to remind himself for what those boards serve, but in the end he remembered and decided to have a liitle play with them (in them memory of old good times). Soon he realised that he had problem with their combining.Help little Z to combine the largest array possible of the dominos,considering the well-known rules.

    INPUT:
    Input is read from standard input.In the first line is number N (number of dominos, N<=100). In the next N lines are read two numbers( 0<= X,Y <= 6) which represent the numbers of a specific domino.

    OUTPUT:
    To the standard output you should output the largest possible array that can be combined with the given dominos.

    Input:
    3
    1 3
    3 2
    2 6

    Output:
    3

    I wrote program like this:

    Code:
    program zdom;
    var n,a,b,c:integer;
    x,y:array [1..100] of integer;
    begin
    readln(n);
    for a:=1 to n do
    begin
    readln(x[a],y[a]);
    end;
    b:=0;
    for c:=1 to n do
    begin
    if (x[c]=y[c]) or (y[c]=x[c]) or (x[c]=x[c]) or (y[c]=y[c]) then
    begin
    b:=b+1;
    end;
    end;
    writeln(b);
    end.
    Task has 15 tests and only 7 is correct when i check with my program. And my question is what is wrong with my program.
    Last edited by WA; 07-27-2009 at 06:07 PM.

  • #2
    Banned
    Join Date
    Jun 2007
    Location
    Web Designer
    Posts
    321
    Thanks
    0
    Thanked 6 Times in 6 Posts
    x[c]=x[c] will be always true ? what languge is it ?

  • #3
    Regular Coder
    Join Date
    May 2008
    Location
    Lost in Localhost...
    Posts
    702
    Thanks
    3
    Thanked 43 Times in 42 Posts
    Can someone help me about this task?
    Is this a homework task?
    1.5) No homework assignments - Do not post your entire homework assignment and request that other members do it for you. This is considered cheating, and your thread may even be used by your school to prove your guilt. Now, you may ask for advice or help on a specific aspect of your assignment that you're having trouble with. Use common sense as far as what's acceptable in terms of soliciting help with homework assignments.

  • #4
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Quote Originally Posted by Millenia View Post
    Is this a homework task?
    Some form of competition, apparently.

    http://www.codingforums.com/showthread.php?t=172796


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •